From patchwork Wed Mar 2 06:37:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mi Jinlong X-Patchwork-Id: 602021 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p226ZdWQ026240 for ; Wed, 2 Mar 2011 06:36:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753014Ab1CBGgd (ORCPT ); Wed, 2 Mar 2011 01:36:33 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:49691 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752343Ab1CBGgc (ORCPT ); Wed, 2 Mar 2011 01:36:32 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 4702E17003F; Wed, 2 Mar 2011 14:36:31 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p226Ufj6007396; Wed, 2 Mar 2011 14:30:41 +0800 Received: from [127.0.0.1] ([10.167.225.24]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011030214352320-259872 ; Wed, 2 Mar 2011 14:35:23 +0800 Message-ID: <4D6DE599.3080600@cn.fujitsu.com> Date: Wed, 02 Mar 2011 14:37:13 +0800 From: Mi Jinlong User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "J. Bruce Fields" CC: NFS Subject: [PATCH 17/17] CLNT: test EXCLUSIVE4_1 for different verifier References: <4D6DE26C.3010103@cn.fujitsu.com> In-Reply-To: <4D6DE26C.3010103@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-03-02 14:35:23, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-03-02 14:35:23, Serialize complete at 2011-03-02 14:35:23 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 02 Mar 2011 06:36:34 +0000 (UTC) diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index e961082..b8e2508 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -458,13 +458,14 @@ def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, else: dir = path[:-1] name = path[-1] - if (mode==EXCLUSIVE4) and (verifier==None): + if ((mode==EXCLUSIVE4) or (mode==EXCLUSIVE4_1)) and (verifier==None): verifier = sess.c.verifier if not want_deleg and access & OPEN4_SHARE_ACCESS_WANT_DELEG_MASK == 0: access |= OPEN4_SHARE_ACCESS_WANT_NO_DELEG # Create the file open_op = op.open(seqid, access, deny, open_owner4(clientid, owner), - openflag4(OPEN4_CREATE, createhow4(mode, attrs, verifier)), + openflag4(OPEN4_CREATE, createhow4(mode, attrs, verifier, + creatverfattr(verifier, attrs))), open_claim4(CLAIM_NULL, name)) return sess.compound(use_obj(dir) + [open_op, op.getfh()]) diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py index d5900db..5d8b6b2 100644 --- a/nfs4.1/server41tests/st_open.py +++ b/nfs4.1/server41tests/st_open.py @@ -2,6 +2,7 @@ from st_create_session import create_session from nfs4_const import * from environment import check, checklist, fail, create_file, open_file from nfs4_type import open_owner4, openflag4, createhow4, open_claim4 +from nfs4_type import creatverfattr, fattr4 import nfs4_ops as op import threading @@ -201,3 +202,20 @@ def testReadWrite(t, env): if res.resarray[-1].data != desired: fail("Expected %r, got %r" % (desired, res.resarray[-1].data)) +def testEXCLUSIVE4AtNameAttribute(t, env): + """If the file does exist,but the stored verifier does not match, + then an error of NFS4ERR_EXIST is returned from server. + rfc5661 18.16.3 + + FLAGS: open all + CODE: OPEN6 + """ + c1 = env.c1.new_client(env.testname(t)) + sess1 = c1.create_session() + + res = create_file(sess1, env.testname(t), mode=EXCLUSIVE4_1) + check(res) + + res = create_file(sess1, env.testname(t), mode=EXCLUSIVE4_1, + verifier = "Justtest") + check(res, NFS4ERR_EXIST)