From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] 4.1 CLNT: Test Case for OPEN file with claim_type is CLAIM_FH
Date: Wed, 07 Dec 2011 08:47:43 +0800 [thread overview]
Message-ID: <4EDEB7AF.9040108@cn.fujitsu.com> (raw)
In-Reply-To: <20111206222801.GG12640@fieldses.org>
J. Bruce Fields:
> On Mon, Nov 28, 2011 at 10:33:42AM +0800, Mi Jinlong wrote:
>> Hi Bruce,
>>
>> Sorry for so late replying you.
>>
>> Mi Jinlong :
>>> J. Bruce Fields:
>>>> On Thu, Nov 17, 2011 at 10:16:22AM +0800, Mi Jinlong wrote:
>>>>> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>>>>> ---
>>>>> nfs4.1/server41tests/st_open.py | 38 +++++++++++++++++++++++++++++++++++++-
>>>>> 1 files changed, 37 insertions(+), 1 deletions(-)
>>>>>
>>>>> diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py
>>>>> index bd995a5..87b58b3 100644
>>>>> --- a/nfs4.1/server41tests/st_open.py
>>>>> +++ b/nfs4.1/server41tests/st_open.py
>>>>> @@ -1,6 +1,6 @@
>>>>> from st_create_session import create_session
>>>>> from nfs4_const import *
>>>>> -from environment import check, checklist, fail, create_file, open_file
>>>>> +from environment import check, checklist, fail, create_file, open_file, close_file
>>>>> from nfs4_type import open_owner4, openflag4, createhow4, open_claim4
>>>>> from nfs4_type import creatverfattr, fattr4
>>>>> import nfs4_ops as op
>>>>> @@ -200,3 +200,39 @@ def testEXCLUSIVE4AtNameAttribute(t, env):
>>>>> res = create_file(sess1, env.testname(t), mode=EXCLUSIVE4_1,
>>>>> verifier = "Justtest")
>>>>> check(res, NFS4ERR_EXIST)
>>>>> +
>>>>> +def testOPENClaimFH(t, env):
>>>>> + """OPEN file with claim_type is CLAIM_FH
>>>>> +
>>>>> + FLAGS: open all
>>>>> + CODE: OPEN7
>>>>> + """
>>>>> + sess1 = env.c1.new_client_session(env.testname(t))
>>>>> + res = create_file(sess1, env.testname(t))
>>>>> + check(res)
>>>>> +
>>>>> + fh = res.resarray[-1].object
>>>>> + stateid = res.resarray[-2].stateid
>>>>> + res = close_file(sess1, fh, stateid=stateid)
>>>>> + check(res)
>>>>> +
>>>>> + claim = open_claim4(CLAIM_FH)
>>>>> + how = openflag4(OPEN4_NOCREATE)
>>>>> + oowner = open_owner4(0, "My Open Owner 2")
>>>>> + open_op = op.open(0, OPEN4_SHARE_ACCESS_BOTH, OPEN4_SHARE_DENY_NONE,
>>>>> + oowner, how, claim)
>>>>> + res = sess1.compound([op.putfh(fh), open_op])
>>>>> + check(res)
>>>> You could just stop here. But I suppose I don't see a problem with
>>>> doing some IO to the file too just to make sure the open is usable.
>>> Yes, that's right.
>
> OK.
>
>>>>> +
>>>>> + stateid = res.resarray[-1].stateid
>>>>> + stateid.seqid = 0
>>>> Why are you modifying the seqid?
>> At any date writing or reading, seqid should be zero.
>> And, NFS client do as it. So, we set seqid = 0 here.
>
> Ugh, I guess. Seems a little ugly that every test-writer has to
> manually set seqid to 0 before doing IO, but OK.
>
>>>>> + data = "write test data"
>>>>> + res = sess1.compound([op.putfh(fh), op.write(stateid, 5, FILE_SYNC4, data)])
>>>>> + check(res)
>>>>> + res = sess1.compound([op.putfh(fh), op.read(stateid, 0, 1000)])
>>>>> + check(res)
>>>>> + if not res.resarray[-1].eof:
>>>>> + fail("EOF not set on read")
>>>>> + desired = "\0"*5 + data
>>>> Why the five nulls? I don't understand this code....
>> Because we write data at offset 5 above, so there are five nulls exist.
>>
>> + res = sess1.compound([op.putfh(fh), op.write(stateid, 5, FILE_SYNC4, data)])
>
> Oops, I must be blind, thanks for setting me straight!
>
> Could you resend this?
OK, will resend.
>
> (Also, is there anything else you're waiting for me to do?)
Thanks, no.
thanks,
Mi Jinlong
next prev parent reply other threads:[~2011-12-07 0:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 2:16 [PATCH] 4.1 CLNT: Test Case for OPEN file with claim_type is CLAIM_FH Mi Jinlong
2011-11-22 22:26 ` J. Bruce Fields
2011-11-23 1:19 ` Mi Jinlong
2011-11-28 2:33 ` Mi Jinlong
2011-12-06 22:28 ` J. Bruce Fields
2011-12-07 0:47 ` Mi Jinlong [this message]
2011-12-07 0:56 ` [PATCH v2] " Mi Jinlong
2011-12-08 21:09 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EDEB7AF.9040108@cn.fujitsu.com \
--to=mijinlong@cn.fujitsu.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.