From patchwork Mon Dec 23 09:36:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3396311 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2015F9F37A for ; Mon, 23 Dec 2013 09:36:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EC6A20117 for ; Mon, 23 Dec 2013 09:36:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1238A20111 for ; Mon, 23 Dec 2013 09:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756929Ab3LWJgQ (ORCPT ); Mon, 23 Dec 2013 04:36:16 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:63933 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753213Ab3LWJgP (ORCPT ); Mon, 23 Dec 2013 04:36:15 -0500 Received: by mail-pd0-f170.google.com with SMTP id g10so4997643pdj.1 for ; Mon, 23 Dec 2013 01:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=S5TgsPANT5XiRK7W3oG/M8ZfIqI25GaOCSsTHLJLvcw=; b=k480poN3u3ehXL1qzIEHuZ+D7KFjrysrYld+U87ZBCVpTl/rYaawF2Dj88UBGzve8+ yvoeuvpnkBcLqhYrBkE+MOy9eIBTa3THvUT2B0IkF8rZsH2iSKtbNmIurJ0vVkryJCjJ WHMwxQcKjeIuRcsZ/gj/wFUf3AYPymRbDSOpMw0whGPO0fqzlVOze8yCrkLrXNUTa61J QFCHJqrGHnteoXwiPVAgKS1K9o5xvtJLX5dTiKBBS1nTfKNph3CzoHIBZ7eADtWGf9c/ OWUaNbqBfr3Cf+NjchWam/LPGsBxZYtgwzWPcel0ADFViPo/UhcACdsWgiZtx17OtXJN 8e5A== X-Received: by 10.68.200.129 with SMTP id js1mr24768389pbc.14.1387791374935; Mon, 23 Dec 2013 01:36:14 -0800 (PST) Received: from [10.10.19.201] ([211.103.180.226]) by mx.google.com with ESMTPSA id i10sm43134300pat.11.2013.12.23.01.36.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 01:36:13 -0800 (PST) Message-ID: <52B80409.5000302@gmail.com> Date: Mon, 23 Dec 2013 17:36:09 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: linux-nfs@vger.kernel.org Subject: [PATCH] nfs4.1: add test case for ca_maxrequestsize and bad backchannel Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CSESS28: test too small maxrequestsize. CSESS29: test a bug in nfsd by sending many bad backchannel request. Signed-off-by: Kinglong Mee --- nfs4.1/server41tests/st_create_session.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py index 554aa5b..4579fdc 100644 --- a/nfs4.1/server41tests/st_create_session.py +++ b/nfs4.1/server41tests/st_create_session.py @@ -498,3 +498,44 @@ def testRepTooBigToCache(t, env): sid = res.resarray[0].csr_sessionid res = c.c.compound([op.sequence(sid, 1, 0, 0, True)]) check(res, NFS4ERR_REP_TOO_BIG_TO_CACHE) + +def testTooSmallMaxReq(t, env): + """If client selects a value for ca_maxrequestsize such that + a replier on a channel could never send a request, + server SHOULD return NFS4ERR_TOOSMALL + + FLAGS: create_session all + CODE: CSESS28 + """ + c = env.c1.new_client(env.testname(t)) + # CREATE_SESSION with too small ca_maxrequestsize + chan_attrs = channel_attrs4(0,20,8192,8192,128,8,[]) + res = c.c.compound([op.create_session(c.clientid, c.seqid, 0, + chan_attrs, chan_attrs, + 123, [])], None) + check(res, NFS4ERR_TOOSMALL) + +def testDRCMemLeak(t, env): + """Test whether the replier put drc mem after checking back + channel attrs failed. + + FLAGS: create_session all + CODE: CSESS29 + """ + c = env.c1.new_client(env.testname(t)) + fchan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[]) + # CREATE_SESSION with too small ca_maxrequestsize and ca_maxops + bchan_attrs = channel_attrs4(0,10,8192,8192,128,1,[]) + + N = 10000 # number of clients to create, all will denied with TOOSMALL + for i in range(N): + res = c.c.compound([op.create_session(c.clientid, c.seqid, 0, + fchan_attrs, bchan_attrs, + 123, [])], None) + check(res, NFS4ERR_TOOSMALL) + + bchan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[]) + res = c.c.compound([op.create_session(c.clientid, c.seqid, 0, + fchan_attrs, bchan_attrs, + 123, [])], None) + check(res, NFS4_OK)