2011-12-08 16:56:30

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: [PATCH 1/2] create open requests without executing


Signed-off-by: Tigran Mkrtchyan <[email protected]>
---
nfs4.1/server41tests/environment.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 6e68e83..6f3bd0a 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -453,6 +453,17 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
deleg_type=None,
open_create=OPEN4_NOCREATE,
seqid=0, clientid=0):
+ return sess.compound(open_create_file_op())
+
+def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+ access=OPEN4_SHARE_ACCESS_BOTH,
+ deny=OPEN4_SHARE_DENY_NONE,
+ mode=GUARDED4, verifier=None,
+ claim_type=CLAIM_NULL,
+ want_deleg=False,
+ deleg_type=None,
+ open_create=OPEN4_NOCREATE,
+ seqid=0, clientid=0):
# Set defaults
if path is None:
dir = sess.c.homedir
@@ -485,7 +496,7 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
open_op = op.open(seqid, access, deny, open_owner4(clientid, owner),
openflag, openclaim)

- return sess.compound(fh_op + [open_op, op.getfh()])
+ return fh_op + [open_op, op.getfh()]

def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
access=OPEN4_SHARE_ACCESS_BOTH,
--
1.7.7



2011-12-09 13:04:13

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: Re: [PATCH 1/2] create open requests without executing

On Thu, Dec 8, 2011 at 10:31 PM, J. Bruce Fields <[email protected]> wrote:
> On Thu, Dec 08, 2011 at 05:51:51PM +0100, Tigran Mkrtchyan wrote:
>>
>> Signed-off-by: Tigran Mkrtchyan <[email protected]>
>> ---
>>  nfs4.1/server41tests/environment.py |   13 ++++++++++++-
>>  1 files changed, 12 insertions(+), 1 deletions(-)
>>
>> diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
>> index 6e68e83..6f3bd0a 100644
>> --- a/nfs4.1/server41tests/environment.py
>> +++ b/nfs4.1/server41tests/environment.py
>> @@ -453,6 +453,17 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
>>                    deleg_type=None,
>>                    open_create=OPEN4_NOCREATE,
>>                    seqid=0, clientid=0):
>> +    return sess.compound(open_create_file_op())
>
> I get:
>
>        ...
>        File "/root/pynfs/nfs4.1/server41tests/environment.py", line 456, in open_create_file
>        return sess.compound(open_create_file_op())
>    TypeError: open_create_file_op() takes at least 2 arguments (0 given)
>
> Also, the following patch has some minor conflicts with Mi Jinlong's
> recent patch.  I don't mind fixing that up myself, but if you're
> regenerating these patches anyway, maybe you could?


rebased, fixed, updated.

Tigran.


>
> Thanks.
>
> --b.
>
>> +
>> +def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
>> +                     access=OPEN4_SHARE_ACCESS_BOTH,
>> +                     deny=OPEN4_SHARE_DENY_NONE,
>> +                  mode=GUARDED4, verifier=None,
>> +                  claim_type=CLAIM_NULL,
>> +                  want_deleg=False,
>> +                  deleg_type=None,
>> +                  open_create=OPEN4_NOCREATE,
>> +                  seqid=0, clientid=0):
>>      # Set defaults
>>      if path is None:
>>          dir = sess.c.homedir
>> @@ -485,7 +496,7 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
>>      open_op = op.open(seqid, access, deny, open_owner4(clientid, owner),
>>                        openflag, openclaim)
>>
>> -    return sess.compound(fh_op + [open_op, op.getfh()])
>> +    return fh_op + [open_op, op.getfh()]
>>
>>  def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
>>                  access=OPEN4_SHARE_ACCESS_BOTH,
>> --
>> 1.7.7
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

2011-12-08 21:31:53

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 1/2] create open requests without executing

On Thu, Dec 08, 2011 at 05:51:51PM +0100, Tigran Mkrtchyan wrote:
>
> Signed-off-by: Tigran Mkrtchyan <[email protected]>
> ---
> nfs4.1/server41tests/environment.py | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
> index 6e68e83..6f3bd0a 100644
> --- a/nfs4.1/server41tests/environment.py
> +++ b/nfs4.1/server41tests/environment.py
> @@ -453,6 +453,17 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
> deleg_type=None,
> open_create=OPEN4_NOCREATE,
> seqid=0, clientid=0):
> + return sess.compound(open_create_file_op())

I get:

...
File "/root/pynfs/nfs4.1/server41tests/environment.py", line 456, in open_create_file
return sess.compound(open_create_file_op())
TypeError: open_create_file_op() takes at least 2 arguments (0 given)

Also, the following patch has some minor conflicts with Mi Jinlong's
recent patch. I don't mind fixing that up myself, but if you're
regenerating these patches anyway, maybe you could?

Thanks.

--b.

> +
> +def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
> + access=OPEN4_SHARE_ACCESS_BOTH,
> + deny=OPEN4_SHARE_DENY_NONE,
> + mode=GUARDED4, verifier=None,
> + claim_type=CLAIM_NULL,
> + want_deleg=False,
> + deleg_type=None,
> + open_create=OPEN4_NOCREATE,
> + seqid=0, clientid=0):
> # Set defaults
> if path is None:
> dir = sess.c.homedir
> @@ -485,7 +496,7 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
> open_op = op.open(seqid, access, deny, open_owner4(clientid, owner),
> openflag, openclaim)
>
> - return sess.compound(fh_op + [open_op, op.getfh()])
> + return fh_op + [open_op, op.getfh()]
>
> def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
> access=OPEN4_SHARE_ACCESS_BOTH,
> --
> 1.7.7
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-12-08 16:56:30

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: [PATCH 2/2] client: add open+close test with current stateid


Signed-off-by: Tigran Mkrtchyan <[email protected]>
---
nfs4.1/server41tests/st_open.py | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py
index bd995a5..6b82e9d 100644
--- a/nfs4.1/server41tests/st_open.py
+++ b/nfs4.1/server41tests/st_open.py
@@ -1,8 +1,9 @@
from st_create_session import create_session
from nfs4_const import *
from environment import check, checklist, fail, create_file, open_file
+from environment import open_create_file_op
from nfs4_type import open_owner4, openflag4, createhow4, open_claim4
-from nfs4_type import creatverfattr, fattr4
+from nfs4_type import creatverfattr, fattr4, stateid4
import nfs4_ops as op
import threading

@@ -200,3 +201,17 @@ def testEXCLUSIVE4AtNameAttribute(t, env):
res = create_file(sess1, env.testname(t), mode=EXCLUSIVE4_1,
verifier = "Justtest")
check(res, NFS4ERR_EXIST)
+
+def testOpenAndClose(t, env):
+ """test current state id processing by having OPEN and CLOSE
+ in a single compound
+
+ FLAGS: open all
+ CODE: OPEN31
+ """
+ current_stateid = stateid4(1, '\0' * 12)
+ sess1 = env.c1.new_client_session(env.testname(t))
+
+ open_op = open_create_file_op(sess1, env.testname(t), open_create=OPEN4_CREATE)
+ res = sess1.compound(open_op + [op.close(0, current_stateid)])
+ check(res, NFS4_OK)
--
1.7.7