2016-11-27 06:27:24

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 00/12] Flex File support

I wanted to add client support for the flex file layout.

Note, I did not add pynfs as a flag because I didn't want to
mess up with any existing uses of it.

The other major change here is in closing all opened
files and destroying all clientids. With all the tests
which run against my server, there are no longer any
open files. There are however 11 clientids remaining.

I will track those down.

fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.=
git

Tom Haynes (12):
According to RFC7863, this is not an array
Close the files opened in the OPEN tests
Some more file closes to cleanup state on the server
Get rid of the client records as well as the session records
Really, really close those open temp files to remove state on the
server
Add xdr for Flex Files Layout Type
Simple tests of the flex file layout type
Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent
layoutgets
Check that the flex file access uid/gid are correct for the different
iomodes
FFLS1: Simulate LAYOUTSTATS for 20 small file creations
Factor out checking seqid for flex file layouts
Add layoutstats tests for flex files

nfs4.1/nfs4client.py | 5 +-
nfs4.1/server41tests/__init__.py | 1 +
nfs4.1/server41tests/environment.py | 5 +
nfs4.1/server41tests/st_current_stateid.py | 36 +-
nfs4.1/server41tests/st_debug.py | 18 +-
nfs4.1/server41tests/st_flex.py | 594 ++++++++++++++++++++++++=
++++
nfs4.1/server41tests/st_open.py | 29 +-
nfs4.1/server41tests/st_reclaim_complete.py | 4 +
nfs4.1/server41tests/st_rename.py | 4 +
nfs4.1/server41tests/st_secinfo.py | 20 +-
nfs4.1/server41tests/st_sequence.py | 8 +
nfs4.1/testmod.py | 1 +
nfs4.1/xdrdef/nfs4.x | 99 ++++-
13 files changed, 812 insertions(+), 12 deletions(-)
create mode 100644 nfs4.1/server41tests/st_flex.py

--=20
2.3.6



2016-11-27 06:27:24

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 01/12] According to RFC7863, this is not an array

And I'm pretty sure we had to change this to be compliant with
the Linux implementation.

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/xdrdef/nfs4.x | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nfs4.1/xdrdef/nfs4.x b/nfs4.1/xdrdef/nfs4.x
index 23c6d7c..16870f7 100644
--- a/nfs4.1/xdrdef/nfs4.x
+++ b/nfs4.1/xdrdef/nfs4.x
@@ -897,7 +897,7 @@ typedef change_policy4 fattr4_change_policy;
typedef uint64_t fattr4_space_freed;
typedef change_attr_type4
fattr4_change_attr_type;
-typedef sec_label4 fattr4_sec_label<>;
+typedef sec_label4 fattr4_sec_label;
typedef uint32_t fattr4_clone_blksize;
=20
%/*
--=20
2.3.6


2016-11-27 06:27:32

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 04/12] Get rid of the client records as well as the session records

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/nfs4client.py | 5 ++++-
nfs4.1/server41tests/environment.py | 5 +++++
nfs4.1/testmod.py | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 0a25bcf..2e22695 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -40,6 +40,7 @@ class NFS4Client(rpc.Client, rpc.Server):
self.server_address =3D (host, port)
self.c1 =3D self.connect(self.server_address)
self.sessions =3D {} # XXX Really, this should be per server
+ self.clients =3D {} # XXX Really, this should be per server
self.ctrl_proc =3D ctrl_proc
self.summary =3D summary
=20
@@ -313,7 +314,9 @@ class NFS4Client(rpc.Client, rpc.Server):
cred)
nfs4lib.check(res, expect)
if expect =3D=3D NFS4_OK:
- return ClientRecord(res.resarray[0], self, cred, protect)
+ client_rec =3D ClientRecord(res.resarray[0], self, cred, prote=
ct)
+ self.clients[client_rec.clientid] =3D client_rec
+ return client_rec
else:
return None
=20
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/env=
ironment.py
index 7384b3c..a910a69 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -257,6 +257,11 @@ class Environment(testmod.Environment):
for sessionid in self.c1.sessions.keys():
self.c1.compound([op.destroy_session(sessionid)])
=20
+ def clean_clients(self):
+ """Destroy client name env.c1"""
+ for clientid in self.c1.clients.keys():
+ self.c1.compound([op.destroy_clientid(clientid)])
+
#########################################
debug_fail =3D False
=20
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index ce25974..c5ca0fe 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -222,6 +222,7 @@ class Test(object):
self.runtest(self, environment)
self.result =3D self._pass_result
=09 environment.clean_sessions()
+=09 environment.clean_clients()
except KeyboardInterrupt:
raise
except TestException, e:
--=20
2.3.6


2016-11-27 06:27:31

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 03/12] Some more file closes to cleanup state on the server

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_current_stateid.py | 12 +++++++++++-
nfs4.1/server41tests/st_debug.py | 18 ++++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41te=
sts/st_current_stateid.py
index a0d6757..01d78c0 100644
--- a/nfs4.1/server41tests/st_current_stateid.py
+++ b/nfs4.1/server41tests/st_current_stateid.py
@@ -46,6 +46,8 @@ def testLockLockU(t, env):
=09op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ]
res =3D sess1.compound([op.putfh(fh)] + lock_ops)
check(res, NFS4_OK)
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
=20
def testOpenWriteClose(t, env):
"""test current state id processing by having OPEN, WRITE and CLOSE
@@ -132,6 +134,10 @@ def testOpenLayoutGet(t, env):
[op.layoutget(False, LAYOUT4_NFSV4_1_FILES, LAYOUTIOMODE4_RW,
0, 8192, 8192, current_stateid, 0xffff)])
check(res, NFS4_OK)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
+ res =3D close_file(sess, fh, stateid=3Dstateid)
+ check(res)
=20
def testOpenSetattr(t, env):
"""test current state id processing by having OPEN and SETATTR
@@ -145,8 +151,12 @@ def testOpenSetattr(t, env):
=20
open_op =3D open_create_file_op(sess, env.testname(t), open_create=3DO=
PEN4_CREATE)
res =3D sess.compound( open_op +
- [ op.setattr(current_stateid, {FATTR4_SIZE: size})])
+ [op.getfh(), op.setattr(current_stateid, {FATTR4_SIZE: size})])
check(res, NFS4_OK)
+ fh =3D res.resarray[-3].object
+ stateid =3D res.resarray[-4].stateid
+ res =3D close_file(sess, fh, stateid=3Dstateid)
+ check(res)
=20
def testOpenFreestateidClose(t, env):
"""test current state id processing by having OPEN, FREE_STATEID and C=
LOSE
diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_deb=
ug.py
index 2b9890e..532ee7a 100644
--- a/nfs4.1/server41tests/st_debug.py
+++ b/nfs4.1/server41tests/st_debug.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from xdrdef.nfs4_const import *
-from environment import check, fail, create_file
+from environment import check, fail, create_file, close_file
from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_clai=
m4
import nfs_ops
op =3D nfs_ops.NFS4ops()
@@ -19,6 +19,8 @@ def testSupported2(t, env):
access=3DOPEN4_SHARE_ACCESS_READ |
OPEN4_SHARE_ACCESS_WANT_READ_DELEG)
check(res) # STUB Should check delegation was granted
+ fh1 =3D res.resarray[-1].object
+ stateid1 =3D res.resarray[-2].stateid
# c2 - OPEN - WRITE
c2 =3D env.c1.new_client("%s_2" % env.testname(t))
sess2 =3D c2.create_session()
@@ -31,6 +33,12 @@ def testSupported2(t, env):
# STUB - since we are not handling callback, deleg_return never gets d=
one
print res
check(res)
+ fh2 =3D res.resarray[-1].object
+ stateid2 =3D res.resarray[-2].stateid
+ res =3D close_file(sess1, fh1, stateid=3Dstateid1)
+ check(res)
+ res =3D close_file(sess2, fh2, stateid=3Dstateid2)
+ check(res)
=20
def testReadWrite(t, env):
"""Do a simple READ and WRITE
@@ -58,7 +66,8 @@ def testReadWrite(t, env):
res =3D sess1.compound([op.putfh(fh), op.read(stateid, 0, 1000)])
print res
check(res)
-
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
=20
def testDeadlock(t, env):
"""Trigger deadlock bug
@@ -87,6 +96,8 @@ def testDeadlock(t, env):
res =3D sess1.listen(xid)
check(res)
print res
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
=20
def testLayout(t, env):
"""Verify layout handling
@@ -103,11 +114,14 @@ def testLayout(t, env):
check(openres)
# Get a layout
fh =3D openres.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
ops =3D [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_READ,
0, 0xffffffff, 4*blocksize, 0xffff)]
res =3D sess.compound(ops)
check(res)
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
=20
def testGetDevList(t, env):
"""Check devlist
--=20
2.3.6


2016-11-27 06:27:36

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 02/12] Close the files opened in the OPEN tests

Otherwise open files are left behind and as each test gets
their own client ID.

Also, as OPEN7 can get a delegation from an agressive server
and pynfs does not handle CBs, do not get the delegation.

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_open.py | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open=
.py
index 235212c..473732d 100644
--- a/nfs4.1/server41tests/st_open.py
+++ b/nfs4.1/server41tests/st_open.py
@@ -29,12 +29,17 @@ def testSupported(t, env):
# See 8.1.3.1 of draft-10:
# the server MUST provide an "seqid" value starting at one...
expect(res, seqid=3D1)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
# STUB - need to check open_res.delegation.delegation_type
# see draft-10 line 19445
# QUESTION - what does "If the server supports the new _WANT_ flags" m=
ean?
# will the server return INVAL? NOTSUPP? or just silently ignore?
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testServerStateSeqid(t, env):
"""Do multiple OPENs of a file, check that server bumps stateid.seqid
=20
@@ -51,8 +56,14 @@ def testServerStateSeqid(t, env):
res =3D open_file(sess1, owner, path, access=3DOPEN4_SHARE_ACCESS_READ=
)
check(res)
expect(res, seqid=3D2)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
+
# STUB - need to check no delegation return
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testReadWrite(t, env):
"""Do a simple READ and WRITE
=20
@@ -78,6 +89,9 @@ def testReadWrite(t, env):
if res.resarray[-1].data !=3D desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testAnonReadWrite(t, env):
"""Do a simple READ and WRITE using anonymous stateid
=20
@@ -93,6 +107,7 @@ def testAnonReadWrite(t, env):
data =3D "write test data"
stateid =3D res.resarray[-2].stateid
res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
res =3D sess1.compound([op.putfh(fh), op.write(nfs4lib.state00, 5, FIL=
E_SYNC4, data)])
check(res)
res =3D sess1.compound([op.putfh(fh), op.read(nfs4lib.state00, 0, 1000=
)])
@@ -115,11 +130,16 @@ def testEXCLUSIVE4AtNameAttribute(t, env):
=20
res =3D create_file(sess1, env.testname(t), mode=3DEXCLUSIVE4_1)
check(res)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
res =3D create_file(sess1, env.testname(t), mode=3DEXCLUSIVE4_1,
verifier =3D "Justtest")
check(res, NFS4ERR_EXIST)
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testOPENClaimFH(t, env):
"""OPEN file with claim_type is CLAIM_FH
=20
@@ -127,7 +147,7 @@ def testOPENClaimFH(t, env):
CODE: OPEN7
"""
sess1 =3D env.c1.new_client_session(env.testname(t))
- res =3D create_file(sess1, env.testname(t))
+ res =3D create_file(sess1, env.testname(t), want_deleg=3DFalse)
check(res)
=20
fh =3D res.resarray[-1].object
@@ -138,7 +158,9 @@ def testOPENClaimFH(t, env):
claim =3D open_claim4(CLAIM_FH)
how =3D openflag4(OPEN4_NOCREATE)
oowner =3D open_owner4(0, "My Open Owner 2")
- open_op =3D op.open(0, OPEN4_SHARE_ACCESS_BOTH, OPEN4_SHARE_DENY_NONE,
+ access =3D OPEN4_SHARE_ACCESS_BOTH|OPEN4_SHARE_ACCESS_WANT_NO_DELEG
+
+ open_op =3D op.open(0, access, OPEN4_SHARE_DENY_NONE,
oowner, how, claim)
res =3D sess1.compound([op.putfh(fh), open_op])
check(res)
@@ -156,6 +178,9 @@ def testOPENClaimFH(t, env):
if res.resarray[-1].data !=3D desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testCloseWithZeroSeqid(t, env):
"""OPEN followed by CLOSE with stateid.seq =3D 0
=20
--=20
2.3.6


2016-11-27 06:27:40

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 07/12] Simple tests of the flex file layout type

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/__init__.py | 1 +
nfs4.1/server41tests/st_flex.py | 144 +++++++++++++++++++++++++++++++++++=
++++
2 files changed, 145 insertions(+)
create mode 100644 nfs4.1/server41tests/st_flex.py

diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init=
__.py
index 8a423e1..a38c314 100644
--- a/nfs4.1/server41tests/__init__.py
+++ b/nfs4.1/server41tests/__init__.py
@@ -23,4 +23,5 @@ __all__ =3D ["st_exchange_id.py", # draft 21
## "st_loop",
"st_current_stateid.py",
=09 "st_sparse.py",
+ "st_flex.py",
]
diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
new file mode 100644
index 0000000..bb4405c
--- /dev/null
+++ b/nfs4.1/server41tests/st_flex.py
@@ -0,0 +1,144 @@
+from xdrdef.nfs4_const import *
+from xdrdef.nfs4_type import *
+from xdrdef.nfs4_pack import *
+import nfs_ops
+op =3D nfs_ops.NFS4ops()
+from environment import check, fail, create_file, close_file
+from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \
+=09NFS4Unpacker as FlexUnpacker
+from nfs4lib import FancyNFS4Packer, get_nfstime
+
+def testStateid1(t, env):
+ """Check for proper sequence handling in layout stateids.
+
+ FLAGS: flex
+ CODE: FFST1
+ """
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout 1
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
+ 0, 8192, 8192, open_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D 1:
+ # From draft23 12.5.2 "The first successful LAYOUTGET processed by
+ # the server using a non-layout stateid as an argument MUST have t=
he
+ # "seqid" field of the layout stateid in the response set to one."
+ fail("Expected stateid.seqid=3D=3D1, got %i" % lo_stateid.seqid)
+ for i in range(6):
+ # Get subsequent layouts
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
+ (i+1)*8192, 8192, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D i + 2:
+ # From draft23 12.5.3 "After the layout stateid is established=
,
+ # the server increments by one the value of the "seqid" in eac=
h
+ # subsequent LAYOUTGET and LAYOUTRETURN response,
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (i+2, lo_state=
id.seqid))
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
+def testFlexGetLayout(t, env):
+ """Verify layout handling
+
+ FLAGS: flex
+ CODE: FFGLO1
+ """
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_READ,
+ 0, 0xffffffffffffffff, 4196, open_stateid, 0xffff)=
]
+ res =3D sess.compound(ops)
+ check(res)
+ # Parse opaque
+ for layout in res.resarray[-1].logr_layout:
+ if layout.loc_type =3D=3D LAYOUT4_FLEX_FILES:
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
+def testFlexLayoutReturnFile(t, env):
+ """
+ Return a file's layout
+
+ FLAGS: flex
+ DEPEND: FFGLO1
+ CODE: FFLOR1
+ """
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_READ,
+ 0, 0xffffffffffffffff, 4196, open_stateid, 0xffff)=
]
+ res =3D sess.compound(ops)
+ check(res)
+ # Return layout
+ layout_stateid =3D res.resarray[-1].logr_stateid
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffffffff=
fffffff, layout_stateid, "")))]
+ res =3D sess.compound(ops)
+ check(res)
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
+def testFlexLayoutStress(t, env):
+ """Alternate LAYOUTIOMODE4_RW/LAYOUTIOMODE4_READ layout segments in th=
e file
+
+ FLAGS: flex
+ CODE: FFLG2
+ """
+ seqid_next =3D 1
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout 1
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ lo_stateid =3D open_stateid
+
+ for i in range(1000):
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_READ if i%2 else LAYOUTIOMODE4_=
RW,
+ i * 8192, 8192, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D seqid_next:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, l=
o_stateid.seqid))
+ seqid_next +=3D 1
+
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffffffff=
fffffff, lo_stateid, "")))]
+ res =3D sess.compound(ops)
+ check(res)
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
--=20
2.3.6


2016-11-27 06:27:33

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 05/12] Really, really close those open temp files to remove state on the server

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_current_stateid.py | 24 ++++++++++++++++++++++++
nfs4.1/server41tests/st_reclaim_complete.py | 4 ++++
nfs4.1/server41tests/st_rename.py | 4 ++++
nfs4.1/server41tests/st_secinfo.py | 20 ++++++++++++++++----
nfs4.1/server41tests/st_sequence.py | 8 ++++++++
5 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41te=
sts/st_current_stateid.py
index 01d78c0..792eee8 100644
--- a/nfs4.1/server41tests/st_current_stateid.py
+++ b/nfs4.1/server41tests/st_current_stateid.py
@@ -99,10 +99,23 @@ def testOpenLookupClose(t, env):
=20
fname =3D env.testname(t)
open_op =3D open_create_file_op(sess1, fname, open_create=3DOPEN4_CREA=
TE)
+
lookup_op =3D env.home + [op.lookup(fname)]
res =3D sess1.compound(open_op + lookup_op + [op.close(0, current_stat=
eid)])
check(res, [NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID])
=20
+ # An unknown number of lookups will be present
+ for r in res.resarray:
+ if r.resop =3D=3D OP_OPEN:
+ stateid =3D r.stateid
+ elif r.resop =3D=3D OP_GETFH:
+ fh =3D r.object
+ break
+
+ # Test passed, now cleanup!
+ res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
def testCloseNoStateid(t, env):
"""test current state id processing by having CLOSE
without operation which provides stateid
@@ -120,6 +133,10 @@ def testCloseNoStateid(t, env):
res =3D sess1.compound([op.putfh(fh), op.close(0, current_stateid)])
check(res, [NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID])
=20
+ # Test passed, now cleanup!
+ res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
def testOpenLayoutGet(t, env):
"""test current state id processing by having OPEN and LAYOUTGET
in a single compound
@@ -170,6 +187,13 @@ def testOpenFreestateidClose(t, env):
open_op =3D open_create_file_op(sess1, env.testname(t), open_create=3D=
OPEN4_CREATE)
res =3D sess1.compound(open_op + [op.free_stateid(current_stateid), op=
.close(0, current_stateid)])
check(res, NFS4ERR_LOCKS_HELD)
+ fh =3D res.resarray[-2].object
+ stateid =3D res.resarray[-3].stateid
+
+ # Test passed, now cleanup!
+ res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
=20
def testOpenSaveFHLookupRestoreFHClose(t, env):
"""test current state id processing by having OPEN, SAVEFH, LOOKUP, RE=
STOREFH and CLOSE
diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41t=
ests/st_reclaim_complete.py
index e945a9f..642ada2 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -47,6 +47,10 @@ def testReclaimAfterRECC(t, env):
=20
check(res, NFS4ERR_NO_GRACE, warnlist =3D [NFS4ERR_EXIST | NFS4ERR_REC=
LAIM_BAD])
=20
+ # Cleanup
+ res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
def testOpenBeforeRECC(t, env):
"""After a client establishes a new client ID, if non-reclaim
locking operations are done before the RECLAIM_COMPLETE,
diff --git a/nfs4.1/server41tests/st_rename.py b/nfs4.1/server41tests/st_re=
name.py
index d87cca0..c7c2c20 100644
--- a/nfs4.1/server41tests/st_rename.py
+++ b/nfs4.1/server41tests/st_rename.py
@@ -496,6 +496,10 @@ def testSelfRenameFile(t, env):
t.fail("RENAME of file %s into itself should do nothing, "
"but cinfo was changed" % name)
=20
+ # Cleanup
+ res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
def testLinkRename(t, env):
"""RENAME of file into its hard link should do nothing
=20
diff --git a/nfs4.1/server41tests/st_secinfo.py b/nfs4.1/server41tests/st_s=
ecinfo.py
index 234ec80..008dc1e 100644
--- a/nfs4.1/server41tests/st_secinfo.py
+++ b/nfs4.1/server41tests/st_secinfo.py
@@ -20,14 +20,20 @@ def testSupported(t, env):
path =3D sess.c.homedir + [name]
res =3D create_file(sess, owner, path, access=3DOPEN4_SHARE_ACCESS_WRI=
TE)
check(res)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
# Get the filehandle of the tmpfile's parent dir
res =3D sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
check(res)
- fh =3D res.resarray[-1].object
+ fh_p =3D res.resarray[-1].object
=20
# Just do a simple SECINFO
- res =3D sess.compound([op.putfh(fh), op.secinfo(name)])
+ res =3D sess.compound([op.putfh(fh_p), op.secinfo(name)])
+ check(res)
+
+ # Cleanup
+ res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
check(res)
=20
def testSupported2(t, env):
@@ -45,12 +51,18 @@ def testSupported2(t, env):
path =3D sess.c.homedir + [name]
res =3D create_file(sess, owner, path, access=3DOPEN4_SHARE_ACCESS_WRI=
TE)
check(res)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
# Get the filehandle of the tmpfile's parent dir
res =3D sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
check(res)
- fh =3D res.resarray[-1].object
+ fh_p =3D res.resarray[-1].object
=20
# GETFH after do a SECINFO should get error NFS4ERR_NOFILEHANDLE
- res =3D sess.compound([op.putfh(fh), op.secinfo(name), op.getfh()])
+ res =3D sess.compound([op.putfh(fh_p), op.secinfo(name), op.getfh()])
check(res, NFS4ERR_NOFILEHANDLE)
+
+ # Cleanup
+ res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_=
sequence.py
index d12f355..d8d460c 100644
--- a/nfs4.1/server41tests/st_sequence.py
+++ b/nfs4.1/server41tests/st_sequence.py
@@ -129,6 +129,9 @@ def testReplayCache002(t, env):
"""
sess1 =3D env.c1.new_client_session(env.testname(t))
res =3D create_file(sess1, "%s_1" % env.testname(t))
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
+
check(res)
ops =3D env.home + [op.savefh(),\
op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
@@ -140,6 +143,11 @@ def testReplayCache002(t, env):
if not nfs4lib.test_equal(res1, res2):
fail("Replay results not equal")
=20
+ # Cleanup
+ res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+ check(res)
+
+
def testReplayCache003(t, env):
"""Send two unsuccessful idempotent compounds with same seqid
=20
--=20
2.3.6


2016-11-27 06:27:43

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 12/12] Add layoutstats tests for flex files

1) Time series where the client resets the data
2) Time series where the reset is straightened out
3) Time series where an I/O stall occurs

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 195 ++++++++++++++++++++++++++++++++++++=
+++-
1 file changed, 194 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index 06dbba8..a14c926 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -327,7 +327,7 @@ def testFlexLayoutStatsSmall(t, env):
2) GETDEVINFO
3) LAYOUTRETURN, CLOSE
=20
- FLAGS: flex
+ FLAGS: flex layoutstats
CODE: FFLS1
"""
lats =3D [93089, 107683, 112340, 113195, 130412, 138390, 140427, 15882=
4, 193078, 201879, 391634, 404757, 2201181, 2232614, 2280089, 2296343, 2341=
763, 2392984, 3064546, 3070314]
@@ -399,3 +399,196 @@ def testFlexLayoutStatsSmall(t, env):
op.close(0, open_stateid)]
res =3D sess.compound(ops)
check(res)
+
+def _LayoutStats(t, env, stats):
+ '''Loop over the provided layoutstats, sending them on in time
+ '''
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ lo_stateid =3D open_stateid
+
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ check_seqid(lo_stateid, 1)
+
+ layout =3D res.resarray[-1].logr_layout[-1]
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+
+ stats_hint =3D opaque.ffl_stats_collect_hint
+
+ # Assume one mirror/storage device
+ ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+ deviceid =3D ds.ffds_deviceid
+
+ ops =3D [op.putfh(fh),
+ op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)]
+ res =3D sess.compound(ops)
+ check(res)
+
+ gda =3D res.resarray[-1].gdir_device_addr
+
+ p =3D FlexUnpacker(gda.da_addr_body)
+ da =3D p.unpack_ff_device_addr4()
+ p.done()
+
+ rd_io =3D io_info4()
+ wr_io =3D io_info4()
+
+ rd_lat =3D ff_io_latency4()
+ wr_lat =3D ff_io_latency4()
+
+ for s in stats:
+ dur =3D get_nfstime(s[1])
+
+ # Did not capture these in the gathered traces
+ offset =3D 0
+ file_length =3D 0xffffffffffffffff
+ rd_io.ii_count =3D 0
+ rd_io.ii_bytes =3D 0
+ wr_io.ii_count =3D 0
+ wr_io.ii_bytes =3D 0
+
+ rd_lat.ffil_ops_requested =3D s[5]
+ rd_lat.ffil_bytes_requested =3D s[4]
+ rd_lat.ffil_ops_completed =3D s[6]
+ rd_lat.ffil_bytes_completed =3D s[2]
+ rd_lat.ffil_bytes_not_delivered =3D s[3]
+ rd_lat.ffil_total_busy_time =3D get_nfstime(s[7])
+ rd_lat.ffil_aggregate_completion_time =3D get_nfstime(s[8])
+ wr_lat.ffil_ops_requested =3D s[12]
+ wr_lat.ffil_bytes_requested =3D s[11]
+ wr_lat.ffil_ops_completed =3D s[13]
+ wr_lat.ffil_bytes_completed =3D s[9]
+ wr_lat.ffil_bytes_not_delivered =3D s[10]
+ wr_lat.ffil_total_busy_time =3D get_nfstime(s[14])
+ wr_lat.ffil_aggregate_completion_time =3D get_nfstime(s[15])
+
+ sleeper =3D s[0]
+ env.sleep(sleeper)
+ fflu =3D ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1=
],
+ rd_lat, wr_lat, dur, True)
+ p =3D FlexPacker()
+ p.pack_ff_layoutupdate4(fflu)
+ lu4 =3D layoutupdate4(LAYOUT4_FLEX_FILES, p.get_buffer())
+
+ ops =3D [op.putfh(fh),
+ op.layoutstats(offset, file_length, lo_stateid, rd_io, wr_i=
o, deviceid, lu4)]
+ res =3D sess.compound(ops)
+ check(res)
+
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffffffff=
fffffff, lo_stateid, "")))]
+ res =3D sess.compound(ops)
+ check(res)
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
+def testFlexLayoutStatsReset(t, env):
+ """These layoutstats are from when the client effectively resets them
+ by having one field be less than the cumulative ancestor
+
+ FLAGS: flex layoustats
+ CODE: FFLS2
+ """
+
+ ls =3D [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 149=
96867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909,=
336986104593],
+ [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 299=
96142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 2999729356=
7, 670368077434],
+ [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 449=
97516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 4499909689=
6, 1004056428600],
+ [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 599=
99263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232=
968, 1340163285214],
+ [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 749=
99204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158=
793, 1676193906267],
+ [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 8=
9999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 900009=
94588, 2006906488984],
+ [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, =
104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 1049=
99171073, 2326727992588],
+ [15, 14997245247, 1466019840, 0, 1466097664, 357934, 357915, 150=
01797989, 277140995467, 487624704, 0, 487677952, 119062, 119049, 1499793974=
5, 179221181962],
+ [15, 29999503656, 2929393664, 0, 2929500160, 715210, 715184, 300=
01965158, 554484427501, 974204928, 0, 974229504, 237849, 237843, 2999879732=
8, 359060066193],
+ [15, 45000138417, 4245204992, 0, 4245245952, 1036437, 1036427, 4=
5005641995, 825579118923, 1411981312, 0, 1412071424, 344744, 344722, 449966=
37179, 547563519532],
+ [15, 60000125536, 5545734144, 0, 5545807872, 1353957, 1353939, 6=
0009284822, 1097378466922, 1844367360, 0, 1844400128, 450293, 450285, 59996=
684404, 735124264647],
+ [15, 14999894874, 1278164992, 0, 1278226432, 312067, 312052, 150=
06094174, 270749903934, 425877504, 0, 425947136, 103991, 103974, 1500034190=
6, 189401125380],
+ [15, 30000017314, 2586595328, 0, 2586648576, 631506, 631493, 300=
09142707, 540229533389, 860536832, 0, 860614656, 210111, 210092, 2999922009=
8, 379353634204],
+ [15, 44999991304, 3859476480, 0, 3859574784, 942279, 942255, 450=
11969088, 808964878766, 1283543040, 0, 1283575808, 313373, 313365, 44999310=
875, 571777183394],
+ [15, 60000803942, 5141098496, 0, 5141168128, 1255168, 1255151, 6=
0015665154, 1075012244233, 1709035520, 0, 1709096960, 417260, 417245, 60000=
142398, 766775808737],
+ [15, 75000722908, 6431453184, 0, 6431526912, 1570197, 1570179, 7=
5018741381, 1344327593333, 2140831744, 0, 2140889088, 522678, 522664, 75000=
341374, 957762218131],
+ [15, 14990345451, 1310584832, 0, 1310654464, 319984, 319967, 149=
90338511, 276432361830, 436121600, 0, 436183040, 106490, 106475, 1499135320=
2, 182231098560],
+ [15, 29990415908, 2630619136, 0, 2630701056, 642261, 642241, 299=
83066936, 554752250256, 875077632, 0, 875126784, 213654, 213642, 2998284579=
3, 362758943732],
+ [15, 44992404751, 3910578176, 0, 3910664192, 954752, 954731, 449=
82785073, 827471490050, 1300946944, 0, 1300992000, 317625, 317614, 44985003=
324, 549721947944]]
+
+ _LayoutStats(t, env, ls)
+
+def testFlexLayoutStatsStraight(t, env):
+ """These stats are the same as the reset ones, but have been massaged
+ to keep the server from detecting the reset. I.e., the client
+ has not lost it all!
+
+ FLAGS: flex layoustats
+ CODE: FFLS3
+ """
+
+ ls =3D [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 149=
96867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909,=
336986104593],
+ [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 299=
96142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 2999729356=
7, 670368077434],
+ [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 449=
97516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 4499909689=
6, 1004056428600],
+ [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 599=
99263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232=
968, 1340163285214],
+ [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 749=
99204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158=
793, 1676193906267],
+ [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 8=
9999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 900009=
94588, 2006906488984],
+ [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, =
104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 1049=
99171073, 2326727992588],
+ [15, 119998955819, 7282450432, 0, 7282565120, 1777970, 1777942, =
119997580860, 1256367773033, 2422800384, 0, 2422947840, 591540, 591504, 119=
997110818, 2505949174550],
+ [15, 135001214228, 8745824256, 0, 8745967616, 2135246, 2135211, =
134997748029, 1533711205067, 2909380608, 0, 2909499392, 710327, 710298, 134=
997968401, 2685788058781],
+ [15, 150001848989, 10061635584, 0, 10061713408, 2456473, 2456454=
, 150001424866, 1804805896489, 3347156992, 0, 3347341312, 817222, 817177, 1=
49995808252, 2874291512120],
+ [15, 165001836108, 11362164736, 0, 11362275328, 2773993, 2773966=
, 165005067693, 2076605244488, 3779543040, 0, 3779670016, 922771, 922740, 1=
64995855477, 3061852257235],
+ [15, 180001730982, 12640329728, 0, 12640501760, 3086060, 3086018=
, 180011161867, 2347355148422, 4205420544, 0, 4205617152, 1026762, 1026714,=
179996197383, 3251253382615],
+ [15, 195001853422, 13948760064, 0, 13948923904, 3405499, 3405459=
, 195014210400, 2616834777877, 4640079872, 0, 4640284672, 1132882, 1132832,=
194995075575, 3441205891439],
+ [15, 210001827412, 15221641216, 0, 15221850112, 3716272, 3716221=
, 210017036781, 2885570123254, 5063086080, 0, 5063245824, 1236144, 1236105,=
209995166352, 3633629440629],
+ [15, 225002640050, 16503263232, 0, 16503443456, 4029161, 4029117=
, 225020732847, 3151617488721, 5488578560, 0, 5488766976, 1340031, 1339985,=
224995997875, 3828628065972],
+ [15, 240002559016, 17793617920, 0, 17793802240, 4344190, 4344145=
, 240023809074, 3420932837821, 5920374784, 0, 5920559104, 1445449, 1445404,=
239996196851, 4019614475366],
+ [15, 254992904467, 19104202752, 0, 19104456704, 4664174, 4664112=
, 255014147585, 3697365199651, 6356496384, 0, 6356742144, 1551939, 1551879,=
254987550053, 4201845573926],
+ [15, 269992974924, 20424237056, 0, 20424503296, 4986451, 4986386=
, 270006876010, 3975685088077, 6795452416, 0, 6795685888, 1659103, 1659046,=
269979042644, 4382373419098],
+ [15, 284994963767, 21704196096, 0, 21704466432, 5298942, 5298876=
, 285006594147, 4248404327871, 7221321728, 0, 7221551104, 1763074, 1763018,=
284981200175, 4569336423310]]
+ _LayoutStats(t, env, ls)
+
+def testFlexLayoutStatsOverflow(t, env):
+ """These layoutstats are a write intensive work load in which eventual=
ly one stat takes
+ twice longer than the collection period.
+
+ FLAGS: flex layoustats
+ CODE: FFLS4
+ """
+
+ ls =3D [[27, 27614183359, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 96468992, =
10292, 10240, 26609085208, 134047775590766],
+ [15, 42725368747, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2402213888, =
15847, 11881, 31458638093, 136367242297571],
+ [15, 57912190475, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2406907904, =
15924, 11881, 31458638093, 136367242297571],
+ [15, 72921814168, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 2946293760,=
16847, 15969, 70391696445, 275087250172195],
+ [15, 87922239746, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 3196473344,=
18335, 15969, 70391696445, 275087250172195],
+ [15, 102949476399, 0, 0, 0, 0, 0, 0, 0, 1808183296, 0, 403854540=
8, 20452, 19074, 92455324261, 310159328537298],
+ [15, 117951351182, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 448678297=
6, 22613, 19935, 116950745229, 331739899803911],
+ [16, 133017224561, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 483096166=
4, 23306, 22169, 118004988775, 353778424445917],
+ [15, 148031127154, 0, 0, 0, 0, 0, 0, 0, 4132970496, 0, 596067123=
2, 29861, 26094, 146128115965, 387064682636158],
+ [15, 163058556237, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 755055820=
8, 40590, 39198, 159139080717, 453635077855389],
+ [15, 178067770476, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 783875686=
4, 41554, 39198, 159139080717, 453635077855389],
+ [15, 193081456711, 0, 0, 0, 0, 0, 0, 0, 6428528640, 0, 815149465=
6, 43497, 42179, 189486399712, 517147615890054],
+ [15, 208082626131, 0, 0, 0, 0, 0, 0, 0, 7284596736, 0, 865636761=
6, 47929, 43079, 207082978313, 532741795045495],
+ [15, 223082643294, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 953905561=
6, 58212, 53705, 222083467525, 636168303637199],
+ [15, 238083127306, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 976342630=
4, 62673, 57863, 223491351125, 650450833313121],
+ [15, 253175262253, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 986057113=
6, 65509, 57863, 223491351125, 650450833313121],
+ [15, 268185316876, 0, 0, 0, 0, 0, 0, 0, 8729772032, 0, 105237381=
12, 71014, 65222, 267165070170, 853839631006322],
+ [17, 285787666679, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 107793612=
80, 72612, 66965, 284787142241, 896650223319399],
+ [33, 318568880195, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 107793612=
80, 72613, 72611, 317562885639, 1120229814239633],
+ [15, 333747489171, 0, 0, 0, 0, 0, 0, 0, 10788278272, 0, 10788802=
560, 74918, 74790, 332233465692, 1121703181284495],
+ [15, 348749618256, 0, 0, 0, 0, 0, 0, 0, 10801360896, 0, 10801885=
184, 78112, 77984, 347235605251, 1123668237106158],
+ [14, 362014682745, 0, 0, 0, 0, 0, 0, 0, 10812923904, 0, 10814496=
768, 81191, 80935, 361134569864, 1125289046746198],
+ [15, 377016435231, 0, 0, 0, 0, 0, 0, 0, 10836291584, 0, 10837864=
448, 86896, 86640, 376136316640, 1127198465086932],
+ [15, 392027464946, 0, 0, 0, 0, 0, 0, 0, 10852364288, 0, 10853937=
152, 90820, 90564, 391147321463, 1129113173731145],
+ [15, 407034683097, 0, 0, 0, 0, 0, 0, 0, 10864914432, 0, 10866487=
296, 93884, 93628, 406154554429, 1131023767183211]]
+ _LayoutStats(t, env, ls)
--=20
2.3.6


2016-11-27 06:27:45

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 11/12] Factor out checking seqid for flex file layouts

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 48 +++++++++++++++++++------------------=
----
1 file changed, 22 insertions(+), 26 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index 6398592..06dbba8 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -10,6 +10,10 @@ from nfs4lib import FancyNFS4Packer, get_nfstime
=20
current_stateid =3D stateid4(1, '\0' * 12)
=20
+def check_seqid(stateid, seqid):
+ if stateid.seqid !=3D seqid:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid, stateid.se=
qid))
+
def testStateid1(t, env):
"""Check for proper sequence handling in layout stateids.
=20
@@ -29,11 +33,12 @@ def testStateid1(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D 1:
- # From draft23 12.5.2 "The first successful LAYOUTGET processed by
- # the server using a non-layout stateid as an argument MUST have t=
he
- # "seqid" field of the layout stateid in the response set to one."
- fail("Expected stateid.seqid=3D=3D1, got %i" % lo_stateid.seqid)
+
+ # From draft23 12.5.2 "The first successful LAYOUTGET processed by
+ # the server using a non-layout stateid as an argument MUST have the
+ # "seqid" field of the layout stateid in the response set to one."
+ check_seqid(lo_stateid, 1)
+
for i in range(6):
# Get subsequent layouts
ops =3D [op.putfh(fh),
@@ -42,11 +47,10 @@ def testStateid1(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D i + 2:
- # From draft23 12.5.3 "After the layout stateid is established=
,
- # the server increments by one the value of the "seqid" in eac=
h
- # subsequent LAYOUTGET and LAYOUTRETURN response,
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (i+2, lo_state=
id.seqid))
+ # From draft23 12.5.3 "After the layout stateid is established,
+ # the server increments by one the value of the "seqid" in each
+ # subsequent LAYOUTGET and LAYOUTRETURN response,
+=09check_seqid(lo_stateid, i + 2)
res =3D close_file(sess, fh, stateid=3Dopen_stateid)
check(res)
=20
@@ -133,8 +137,7 @@ def testFlexLayoutOldSeqid(t, env):
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
=20
- if lo_stateid.seqid !=3D seqid_next:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid.seqid))
+ check_seqid(lo_stateid, seqid_next)
seqid_next +=3D 1
=20
# Get the first with the lo_stateid
@@ -146,8 +149,7 @@ def testFlexLayoutOldSeqid(t, env):
check(res)
lo_stateid2 =3D res.resarray[-1].logr_stateid
=20
- if lo_stateid2.seqid !=3D seqid_next:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid2.seqid))
+ check_seqid(lo_stateid2, seqid_next)
seqid_next +=3D 1
=20
# Get the second with the original lo_stateid
@@ -159,8 +161,7 @@ def testFlexLayoutOldSeqid(t, env):
check(res)
lo_stateid3 =3D res.resarray[-1].logr_stateid
=20
- if lo_stateid3.seqid !=3D seqid_next:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid3.seqid))
+ check_seqid(lo_stateid3, seqid_next)
seqid_next +=3D 1
=20
ops =3D [op.putfh(fh),
@@ -196,8 +197,7 @@ def testFlexLayoutStress(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D seqid_next:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, l=
o_stateid.seqid))
+ check_seqid(lo_stateid, seqid_next)
seqid_next +=3D 1
=20
ops =3D [op.putfh(fh),
@@ -231,8 +231,7 @@ def testFlexGetDevInfo(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D 1:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid.seq=
id))
+ check_seqid(lo_stateid, 1)
=20
layout =3D res.resarray[-1].logr_layout[-1]
p =3D FlexUnpacker(layout.loc_body)
@@ -280,8 +279,7 @@ def testFlexLayoutTestAccess(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D 1:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid.seq=
id))
+ check_seqid(lo_stateid, 1)
=20
layout =3D res.resarray[-1].logr_layout[-1]
p =3D FlexUnpacker(layout.loc_body)
@@ -301,8 +299,7 @@ def testFlexLayoutTestAccess(t, env):
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
- if lo_stateid.seqid !=3D 2:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (2, lo_stateid.seq=
id))
+ check_seqid(lo_stateid, 2)
=20
layout =3D res.resarray[-1].logr_layout[-1]
p =3D FlexUnpacker(layout.loc_body)
@@ -351,8 +348,7 @@ def testFlexLayoutStatsSmall(t, env):
fh =3D res.resarray[-2].object
open_stateid =3D res.resarray[-3].stateid
=20
- if lo_stateid.seqid !=3D 1:
- fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid=
.seqid))
+ check_seqid(lo_stateid, 1)
=20
layout =3D res.resarray[-1].logr_layout[-1]
p =3D FlexUnpacker(layout.loc_body)
--=20
2.3.6


2016-11-27 06:27:46

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 09/12] Check that the flex file access uid/gid are correct for the different iomodes

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 115 ++++++++++++++++++++++++++++++++++++=
++++
1 file changed, 115 insertions(+)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index 8ecb114..fdcfd32 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -206,3 +206,118 @@ def testFlexLayoutStress(t, env):
check(res)
res =3D close_file(sess, fh, stateid=3Dopen_stateid)
check(res)
+
+def testFlexGetDevInfo(t, env):
+ """Get the device info
+
+ FLAGS: flex
+ CODE: FFGDI1
+ """
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout 1
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+ lo_stateid =3D open_stateid
+
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D 1:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid.seq=
id))
+
+ layout =3D res.resarray[-1].logr_layout[-1]
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+
+ # Assume one mirror/storage device
+ ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+ deviceid =3D ds.ffds_deviceid
+
+ ops =3D [op.putfh(fh),
+ op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)]
+ res =3D sess.compound(ops)
+ check(res)
+
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffffffff=
fffffff, lo_stateid, "")))]
+ res =3D sess.compound(ops)
+ check(res)
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
+def testFlexLayoutTestAccess(t, env):
+ """Get both a LAYOUTIOMODE4_RW and LAYOUTIOMODE4_READ segment
+ making sure that they have the same gid, but a different uid.
+
+ FLAGS: flex
+ CODE: FFLA1
+ """
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+ # Get layout 1
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, open_stateid, 0xffff)=
]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D 1:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid.seq=
id))
+
+ layout =3D res.resarray[-1].logr_layout[-1]
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+
+ # Assume one mirror/storage device
+ ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+ uid_rw =3D ds.ffds_user
+ gid_rw =3D ds.ffds_group
+
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_READ,
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ if lo_stateid.seqid !=3D 2:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (2, lo_stateid.seq=
id))
+
+ layout =3D res.resarray[-1].logr_layout[-1]
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+
+ # Assume one mirror/storage device
+ ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+ uid_rd =3D ds.ffds_user
+ gid_rd =3D ds.ffds_group
+
+ if uid_rw =3D=3D uid_rd:
+ fail("Expected uid_rd !=3D %i, got %i" % (uid_rd, uid_rw))
+
+ if gid_rw !=3D gid_rd:
+ fail("Expected gid_rd =3D=3D %i, got %i" % (gid_rd, gid_rw))
+
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
--=20
2.3.6


2016-11-27 06:27:46

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 06/12] Add xdr for Flex Files Layout Type

Note that unlike the block layout, we don't
create a new file as there are too many
dependencies on existing types.

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/xdrdef/nfs4.x | 97 ++++++++++++++++++++++++++++++++++++++++++++++++=
+++-
1 file changed, 96 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/xdrdef/nfs4.x b/nfs4.1/xdrdef/nfs4.x
index 16870f7..c2c9361 100644
--- a/nfs4.1/xdrdef/nfs4.x
+++ b/nfs4.1/xdrdef/nfs4.x
@@ -572,7 +572,8 @@ struct stateid4 {
enum layouttype4 {
LAYOUT4_NFSV4_1_FILES =3D 0x1,
LAYOUT4_OSD2_OBJECTS =3D 0x2,
- LAYOUT4_BLOCK_VOLUME =3D 0x3
+ LAYOUT4_BLOCK_VOLUME =3D 0x3,
+ LAYOUT4_FLEX_FILES =3D 0x4
};
=20
struct layout_content4 {
@@ -3040,6 +3041,100 @@ default:
void;
};
=20
+struct ff_device_versions4 {
+ uint32_t ffdv_version;
+ uint32_t ffdv_minorversion;
+ uint32_t ffdv_rsize;
+ uint32_t ffdv_wsize;
+ bool ffdv_tightly_coupled;
+};
+
+struct ff_device_addr4 {
+ multipath_list4 ffda_netaddrs;
+ ff_device_versions4 ffda_versions<>;
+};
+
+const FF_FLAGS_NO_LAYOUTCOMMIT =3D 0x00000001;
+const FF_FLAGS_NO_IO_THRU_MDS =3D 0x00000002;
+const FF_FLAGS_NO_READ_IO =3D 0x00000004;
+typedef uint32_t ff_flags4;
+
+struct ff_data_server4 {
+ deviceid4 ffds_deviceid;
+ uint32_t ffds_efficiency;
+ stateid4 ffds_stateid;
+ nfs_fh4 ffds_fh_vers<>;
+ fattr4_owner ffds_user;
+ fattr4_owner_group ffds_group;
+};
+
+struct ff_mirror4 {
+ ff_data_server4 ffm_data_servers<>;
+};
+
+struct ff_layout4 {
+ length4 ffl_stripe_unit;
+ ff_mirror4 ffl_mirrors<>;
+ ff_flags4 ffl_flags;
+ uint32_t ffl_stats_collect_hint;
+};
+
+struct ff_ioerr4 {
+ offset4 ffie_offset;
+ length4 ffie_length;
+ stateid4 ffie_stateid;
+ device_error4 ffie_errors<>;
+};
+
+struct ff_io_latency4 {
+ uint64_t ffil_ops_requested;
+ uint64_t ffil_bytes_requested;
+ uint64_t ffil_ops_completed;
+ uint64_t ffil_bytes_completed;
+ uint64_t ffil_bytes_not_delivered;
+ nfstime4 ffil_total_busy_time;
+ nfstime4 ffil_aggregate_completion_time;
+};
+
+struct ff_layoutupdate4 {
+ netaddr4 ffl_addr;
+ nfs_fh4 ffl_fhandle;
+ ff_io_latency4 ffl_read;
+ ff_io_latency4 ffl_write;
+ nfstime4 ffl_duration;
+ bool ffl_local;
+};
+
+struct ff_iostats4 {
+ offset4 ffis_offset;
+ length4 ffis_length;
+ stateid4 ffis_stateid;
+ io_info4 ffis_read;
+ io_info4 ffis_write;
+ deviceid4 ffis_deviceid;
+ ff_layoutupdate4 ffis_layoutupdate;
+};
+
+struct ff_layoutreturn4 {
+ ff_ioerr4 fflr_ioerr_report<>;
+ ff_iostats4 fflr_iostats_report<>;
+};
+
+union ff_mirrors_hint switch (bool ffmc_valid) {
+ case TRUE:
+ uint32_t ffmc_mirrors;
+ case FALSE:
+ void;
+};
+
+struct ff_layouthint4 {
+ ff_mirrors_hint fflh_mirrors_hint;
+};
+
+enum ff_cb_recall_any_mask {
+ FF_RCA4_TYPE_MASK_READ =3D -2,
+ FF_RCA4_TYPE_MASK_RW =3D -1
+};
=20
/*
* Operation arrays (the rest)
--=20
2.3.6


2016-11-27 06:27:47

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 08/12] Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent layoutgets

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 68 +++++++++++++++++++++++++++++++++++++=
++--
1 file changed, 66 insertions(+), 2 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index bb4405c..8ecb114 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -106,6 +106,70 @@ def testFlexLayoutReturnFile(t, env):
res =3D close_file(sess, fh, stateid=3Dopen_stateid)
check(res)
=20
+def testFlexLayoutOldSeqid(t, env):
+ """Check that we do not get NFS4ERR_OLD_STATEID if we send
+ two LAYOUTGETS in a row without bumping the seqid
+
+ FLAGS: flex
+ CODE: FFLOOS
+ """
+ seqid_next =3D 1
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+ # Create the file
+ res =3D create_file(sess, env.testname(t))
+ check(res)
+
+ # Get layout 1
+ fh =3D res.resarray[-1].object
+ open_stateid =3D res.resarray[-2].stateid
+
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, open_stateid, 0xffff)=
]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+
+ if lo_stateid.seqid !=3D seqid_next:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid.seqid))
+ seqid_next +=3D 1
+
+ # Get the first with the lo_stateid
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid2 =3D res.resarray[-1].logr_stateid
+
+ if lo_stateid2.seqid !=3D seqid_next:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid2.seqid))
+ seqid_next +=3D 1
+
+ # Get the second with the original lo_stateid
+ ops =3D [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES,
+ LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ res =3D sess.compound(ops)
+ check(res)
+ lo_stateid3 =3D res.resarray[-1].logr_stateid
+
+ if lo_stateid3.seqid !=3D seqid_next:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (seqid_next, lo_st=
ateid3.seqid))
+ seqid_next +=3D 1
+
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffffffff=
fffffff, lo_stateid, "")))]
+ res =3D sess.compound(ops)
+ check(res)
+ res =3D close_file(sess, fh, stateid=3Dopen_stateid)
+ check(res)
+
def testFlexLayoutStress(t, env):
"""Alternate LAYOUTIOMODE4_RW/LAYOUTIOMODE4_READ layout segments in th=
e file
=20
@@ -117,7 +181,7 @@ def testFlexLayoutStress(t, env):
# Create the file
res =3D create_file(sess, env.testname(t))
check(res)
- # Get layout 1
+
fh =3D res.resarray[-1].object
open_stateid =3D res.resarray[-2].stateid
lo_stateid =3D open_stateid
@@ -126,7 +190,7 @@ def testFlexLayoutStress(t, env):
ops =3D [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_READ if i%2 else LAYOUTIOMODE4_=
RW,
- i * 8192, 8192, 8192, lo_stateid, 0xffff)]
+ 0, 0xffffffffffffffff, 8192, lo_stateid, 0xfff=
f)]
res =3D sess.compound(ops)
check(res)
lo_stateid =3D res.resarray[-1].logr_stateid
--=20
2.3.6


2016-11-27 06:27:48

by Thomas Haynes

[permalink] [raw]
Subject: [PATCH pynfs 10/12] FFLS1: Simulate LAYOUTSTATS for 20 small file creations

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 84 +++++++++++++++++++++++++++++++++++++=
+++-
1 file changed, 83 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index fdcfd32..6398592 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -3,11 +3,13 @@ from xdrdef.nfs4_type import *
from xdrdef.nfs4_pack import *
import nfs_ops
op =3D nfs_ops.NFS4ops()
-from environment import check, fail, create_file, close_file
+from environment import check, fail, create_file, close_file, open_create_=
file_op
from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \
=09NFS4Unpacker as FlexUnpacker
from nfs4lib import FancyNFS4Packer, get_nfstime
=20
+current_stateid =3D stateid4(1, '\0' * 12)
+
def testStateid1(t, env):
"""Check for proper sequence handling in layout stateids.
=20
@@ -321,3 +323,83 @@ def testFlexLayoutTestAccess(t, env):
=20
res =3D close_file(sess, fh, stateid=3Dopen_stateid)
check(res)
+
+def testFlexLayoutStatsSmall(t, env):
+ """Open 20 "small" files and simulate LAYOUTSTATS for them
+ 1) OPEN, LAYOUTGET
+ 2) GETDEVINFO
+ 3) LAYOUTRETURN, CLOSE
+
+ FLAGS: flex
+ CODE: FFLS1
+ """
+ lats =3D [93089, 107683, 112340, 113195, 130412, 138390, 140427, 15882=
4, 193078, 201879, 391634, 404757, 2201181, 2232614, 2280089, 2296343, 2341=
763, 2392984, 3064546, 3070314]
+ durs =3D [3387666, 3439506, 3737081, 4448315, 4380523, 4419273, 441974=
6, 5903420, 5932432, 5932938, 7573082, 11085497, 11125274, 11126513, 137203=
03, 15990926, 16020425, 16020948, 20181628, 20213871]
+
+ if len(lats) !=3D len(durs):
+ fail("Lats and durs not same")
+
+ sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+
+ for i in range(len(lats)):
+ open_op =3D open_create_file_op(sess, env.testname(t) + str(i), op=
en_create=3DOPEN4_CREATE)
+ res =3D sess.compound( open_op +
+ [op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
+ 0, 0xffffffffffffffff, 4196, current_stateid, =
0xffff)])
+ check(res, NFS4_OK)
+ lo_stateid =3D res.resarray[-1].logr_stateid
+ fh =3D res.resarray[-2].object
+ open_stateid =3D res.resarray[-3].stateid
+
+ if lo_stateid.seqid !=3D 1:
+ fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid=
.seqid))
+
+ layout =3D res.resarray[-1].logr_layout[-1]
+ p =3D FlexUnpacker(layout.loc_body)
+ opaque =3D p.unpack_ff_layout4()
+ p.done()
+
+ # Assume one mirror/storage device
+ ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+ stats_hint =3D opaque.ffl_stats_collect_hint
+
+ deviceid =3D ds.ffds_deviceid
+
+ ops =3D [op.putfh(fh),
+ op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, =
0)]
+ res =3D sess.compound(ops)
+ check(res)
+
+ gda =3D res.resarray[-1].gdir_device_addr
+
+ p =3D FlexUnpacker(gda.da_addr_body)
+ da =3D p.unpack_ff_device_addr4()
+ p.done()
+
+ rd_io =3D io_info4(0, 0)
+ wr_io =3D io_info4(1, 16384)
+
+ rd_lat =3D ff_io_latency4(0, 0, 0, 0, 0, nfstime4(0, 0), nfstime4(=
0, 0))
+ wr_lat =3D ff_io_latency4(1, 16384, 1, 16384, 0, nfstime4(0, lats[=
i]), nfstime4(0, lats[i]))
+
+ offset =3D 0
+ file_length =3D 16384
+
+ dur =3D durs[i]
+ fflu =3D ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1=
],
+ rd_lat, wr_lat, nfstime4(0, dur), True)
+
+ ffio =3D ff_iostats4(offset, file_length, lo_stateid, rd_io, wr_io=
, deviceid, fflu)
+ fflr =3D ff_layoutreturn4([], [ffio])
+
+ p =3D FlexPacker()
+ p.pack_ff_layoutreturn4(fflr)
+
+ ops =3D [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_AN=
Y,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, 0xfffff=
fffffffffff, lo_stateid, p.get_buffer()))),
+ op.close(0, open_stateid)]
+ res =3D sess.compound(ops)
+ check(res)
--=20
2.3.6


2016-11-28 16:33:24

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> I wanted to add client support for the flex file layout.
>
> Note, I did not add pynfs as a flag because I didn't want to
> mess up with any existing uses of it.
>
> The other major change here is in closing all opened
> files and destroying all clientids. With all the tests
> which run against my server, there are no longer any
> open files. There are however 11 clientids remaining.
>
> I will track those down.
>
> fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.git

Thanks! I'll try these and take a look.

How did you notice all the leftover state? I run with a pretty short
lease time (to speed testing), so I guess the leftover state must expire
too quickly to cause me problems.

Anyway it's good to have that cleaned up.

--b.

>
> Tom Haynes (12):
> According to RFC7863, this is not an array
> Close the files opened in the OPEN tests
> Some more file closes to cleanup state on the server
> Get rid of the client records as well as the session records
> Really, really close those open temp files to remove state on the
> server
> Add xdr for Flex Files Layout Type
> Simple tests of the flex file layout type
> Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent
> layoutgets
> Check that the flex file access uid/gid are correct for the different
> iomodes
> FFLS1: Simulate LAYOUTSTATS for 20 small file creations
> Factor out checking seqid for flex file layouts
> Add layoutstats tests for flex files
>
> nfs4.1/nfs4client.py | 5 +-
> nfs4.1/server41tests/__init__.py | 1 +
> nfs4.1/server41tests/environment.py | 5 +
> nfs4.1/server41tests/st_current_stateid.py | 36 +-
> nfs4.1/server41tests/st_debug.py | 18 +-
> nfs4.1/server41tests/st_flex.py | 594 ++++++++++++++++++++++++++++
> nfs4.1/server41tests/st_open.py | 29 +-
> nfs4.1/server41tests/st_reclaim_complete.py | 4 +
> nfs4.1/server41tests/st_rename.py | 4 +
> nfs4.1/server41tests/st_secinfo.py | 20 +-
> nfs4.1/server41tests/st_sequence.py | 8 +
> nfs4.1/testmod.py | 1 +
> nfs4.1/xdrdef/nfs4.x | 99 ++++-
> 13 files changed, 812 insertions(+), 12 deletions(-)
> create mode 100644 nfs4.1/server41tests/st_flex.py
>
> --
> 2.3.6
>

2016-11-28 17:01:15

by Tom Haynes

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Mon, Nov 28, 2016 at 11:33:22AM -0500, J. Bruce Fields wrote:
> On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > I wanted to add client support for the flex file layout.
> >
> > Note, I did not add pynfs as a flag because I didn't want to
> > mess up with any existing uses of it.
> >
> > The other major change here is in closing all opened
> > files and destroying all clientids. With all the tests
> > which run against my server, there are no longer any
> > open files. There are however 11 clientids remaining.
> >
> > I will track those down.
> >
> > fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.git
>
> Thanks! I'll try these and take a look.
>
> How did you notice all the leftover state? I run with a pretty short
> lease time (to speed testing), so I guess the leftover state must expire
> too quickly to cause me problems.

In testing, I delete the filesystem pretty quickly after the test run,
and it complains about open files.

>
> Anyway it's good to have that cleaned up.
>
> --b.
>
> >
> > Tom Haynes (12):
> > According to RFC7863, this is not an array
> > Close the files opened in the OPEN tests
> > Some more file closes to cleanup state on the server
> > Get rid of the client records as well as the session records
> > Really, really close those open temp files to remove state on the
> > server
> > Add xdr for Flex Files Layout Type
> > Simple tests of the flex file layout type
> > Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent
> > layoutgets
> > Check that the flex file access uid/gid are correct for the different
> > iomodes
> > FFLS1: Simulate LAYOUTSTATS for 20 small file creations
> > Factor out checking seqid for flex file layouts
> > Add layoutstats tests for flex files
> >
> > nfs4.1/nfs4client.py | 5 +-
> > nfs4.1/server41tests/__init__.py | 1 +
> > nfs4.1/server41tests/environment.py | 5 +
> > nfs4.1/server41tests/st_current_stateid.py | 36 +-
> > nfs4.1/server41tests/st_debug.py | 18 +-
> > nfs4.1/server41tests/st_flex.py | 594 ++++++++++++++++++++++++++++
> > nfs4.1/server41tests/st_open.py | 29 +-
> > nfs4.1/server41tests/st_reclaim_complete.py | 4 +
> > nfs4.1/server41tests/st_rename.py | 4 +
> > nfs4.1/server41tests/st_secinfo.py | 20 +-
> > nfs4.1/server41tests/st_sequence.py | 8 +
> > nfs4.1/testmod.py | 1 +
> > nfs4.1/xdrdef/nfs4.x | 99 ++++-
> > 13 files changed, 812 insertions(+), 12 deletions(-)
> > create mode 100644 nfs4.1/server41tests/st_flex.py
> >
> > --
> > 2.3.6
> >
> --
> 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

2016-11-28 17:22:56

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH pynfs 12/12] Add layoutstats tests for flex files

On Sat, Nov 26, 2016 at 10:26:41PM -0800, Tom Haynes wrote:
> 1) Time series where the client resets the data
> 2) Time series where the reset is straightened out
> 3) Time series where an I/O stall occurs

I can't really follow what this is doing, so I can't tell: will these
tests be useful to anyone with a flexfiles server, or are they specific
to your particular implementation and test configuration?

--b.

>
> Signed-off-by: Tom Haynes <[email protected]>
> ---
> nfs4.1/server41tests/st_flex.py | 195 +++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 194 insertions(+), 1 deletion(-)
>
> diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
> index 06dbba8..a14c926 100644
> --- a/nfs4.1/server41tests/st_flex.py
> +++ b/nfs4.1/server41tests/st_flex.py
> @@ -327,7 +327,7 @@ def testFlexLayoutStatsSmall(t, env):
> 2) GETDEVINFO
> 3) LAYOUTRETURN, CLOSE
>
> - FLAGS: flex
> + FLAGS: flex layoutstats
> CODE: FFLS1
> """
> lats = [93089, 107683, 112340, 113195, 130412, 138390, 140427, 158824, 193078, 201879, 391634, 404757, 2201181, 2232614, 2280089, 2296343, 2341763, 2392984, 3064546, 3070314]
> @@ -399,3 +399,196 @@ def testFlexLayoutStatsSmall(t, env):
> op.close(0, open_stateid)]
> res = sess.compound(ops)
> check(res)
> +
> +def _LayoutStats(t, env, stats):
> + '''Loop over the provided layoutstats, sending them on in time
> + '''
> + sess = env.c1.new_pnfs_client_session(env.testname(t))
> +
> + # Create the file
> + res = create_file(sess, env.testname(t))
> + check(res)
> + fh = res.resarray[-1].object
> + open_stateid = res.resarray[-2].stateid
> + lo_stateid = open_stateid
> +
> + ops = [op.putfh(fh),
> + op.layoutget(False, LAYOUT4_FLEX_FILES,
> + LAYOUTIOMODE4_RW,
> + 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
> + res = sess.compound(ops)
> + check(res)
> + lo_stateid = res.resarray[-1].logr_stateid
> + check_seqid(lo_stateid, 1)
> +
> + layout = res.resarray[-1].logr_layout[-1]
> + p = FlexUnpacker(layout.loc_body)
> + opaque = p.unpack_ff_layout4()
> + p.done()
> +
> + stats_hint = opaque.ffl_stats_collect_hint
> +
> + # Assume one mirror/storage device
> + ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1]
> +
> + deviceid = ds.ffds_deviceid
> +
> + ops = [op.putfh(fh),
> + op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)]
> + res = sess.compound(ops)
> + check(res)
> +
> + gda = res.resarray[-1].gdir_device_addr
> +
> + p = FlexUnpacker(gda.da_addr_body)
> + da = p.unpack_ff_device_addr4()
> + p.done()
> +
> + rd_io = io_info4()
> + wr_io = io_info4()
> +
> + rd_lat = ff_io_latency4()
> + wr_lat = ff_io_latency4()
> +
> + for s in stats:
> + dur = get_nfstime(s[1])
> +
> + # Did not capture these in the gathered traces
> + offset = 0
> + file_length = 0xffffffffffffffff
> + rd_io.ii_count = 0
> + rd_io.ii_bytes = 0
> + wr_io.ii_count = 0
> + wr_io.ii_bytes = 0
> +
> + rd_lat.ffil_ops_requested = s[5]
> + rd_lat.ffil_bytes_requested = s[4]
> + rd_lat.ffil_ops_completed = s[6]
> + rd_lat.ffil_bytes_completed = s[2]
> + rd_lat.ffil_bytes_not_delivered = s[3]
> + rd_lat.ffil_total_busy_time = get_nfstime(s[7])
> + rd_lat.ffil_aggregate_completion_time = get_nfstime(s[8])
> + wr_lat.ffil_ops_requested = s[12]
> + wr_lat.ffil_bytes_requested = s[11]
> + wr_lat.ffil_ops_completed = s[13]
> + wr_lat.ffil_bytes_completed = s[9]
> + wr_lat.ffil_bytes_not_delivered = s[10]
> + wr_lat.ffil_total_busy_time = get_nfstime(s[14])
> + wr_lat.ffil_aggregate_completion_time = get_nfstime(s[15])
> +
> + sleeper = s[0]
> + env.sleep(sleeper)
> + fflu = ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1],
> + rd_lat, wr_lat, dur, True)
> + p = FlexPacker()
> + p.pack_ff_layoutupdate4(fflu)
> + lu4 = layoutupdate4(LAYOUT4_FLEX_FILES, p.get_buffer())
> +
> + ops = [op.putfh(fh),
> + op.layoutstats(offset, file_length, lo_stateid, rd_io, wr_io, deviceid, lu4)]
> + res = sess.compound(ops)
> + check(res)
> +
> + ops = [op.putfh(fh),
> + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> + layoutreturn4(LAYOUTRETURN4_FILE,
> + layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
> + res = sess.compound(ops)
> + check(res)
> + res = close_file(sess, fh, stateid=open_stateid)
> + check(res)
> +
> +def testFlexLayoutStatsReset(t, env):
> + """These layoutstats are from when the client effectively resets them
> + by having one field be less than the cumulative ancestor
> +
> + FLAGS: flex layoustats
> + CODE: FFLS2
> + """
> +
> + ls = [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 14996867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909, 336986104593],
> + [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 29996142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 29997293567, 670368077434],
> + [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 44997516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 44999096896, 1004056428600],
> + [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 59999263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232968, 1340163285214],
> + [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 74999204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158793, 1676193906267],
> + [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 89999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 90000994588, 2006906488984],
> + [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, 104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 104999171073, 2326727992588],
> + [15, 14997245247, 1466019840, 0, 1466097664, 357934, 357915, 15001797989, 277140995467, 487624704, 0, 487677952, 119062, 119049, 14997939745, 179221181962],
> + [15, 29999503656, 2929393664, 0, 2929500160, 715210, 715184, 30001965158, 554484427501, 974204928, 0, 974229504, 237849, 237843, 29998797328, 359060066193],
> + [15, 45000138417, 4245204992, 0, 4245245952, 1036437, 1036427, 45005641995, 825579118923, 1411981312, 0, 1412071424, 344744, 344722, 44996637179, 547563519532],
> + [15, 60000125536, 5545734144, 0, 5545807872, 1353957, 1353939, 60009284822, 1097378466922, 1844367360, 0, 1844400128, 450293, 450285, 59996684404, 735124264647],
> + [15, 14999894874, 1278164992, 0, 1278226432, 312067, 312052, 15006094174, 270749903934, 425877504, 0, 425947136, 103991, 103974, 15000341906, 189401125380],
> + [15, 30000017314, 2586595328, 0, 2586648576, 631506, 631493, 30009142707, 540229533389, 860536832, 0, 860614656, 210111, 210092, 29999220098, 379353634204],
> + [15, 44999991304, 3859476480, 0, 3859574784, 942279, 942255, 45011969088, 808964878766, 1283543040, 0, 1283575808, 313373, 313365, 44999310875, 571777183394],
> + [15, 60000803942, 5141098496, 0, 5141168128, 1255168, 1255151, 60015665154, 1075012244233, 1709035520, 0, 1709096960, 417260, 417245, 60000142398, 766775808737],
> + [15, 75000722908, 6431453184, 0, 6431526912, 1570197, 1570179, 75018741381, 1344327593333, 2140831744, 0, 2140889088, 522678, 522664, 75000341374, 957762218131],
> + [15, 14990345451, 1310584832, 0, 1310654464, 319984, 319967, 14990338511, 276432361830, 436121600, 0, 436183040, 106490, 106475, 14991353202, 182231098560],
> + [15, 29990415908, 2630619136, 0, 2630701056, 642261, 642241, 29983066936, 554752250256, 875077632, 0, 875126784, 213654, 213642, 29982845793, 362758943732],
> + [15, 44992404751, 3910578176, 0, 3910664192, 954752, 954731, 44982785073, 827471490050, 1300946944, 0, 1300992000, 317625, 317614, 44985003324, 549721947944]]
> +
> + _LayoutStats(t, env, ls)
> +
> +def testFlexLayoutStatsStraight(t, env):
> + """These stats are the same as the reset ones, but have been massaged
> + to keep the server from detecting the reset. I.e., the client
> + has not lost it all!
> +
> + FLAGS: flex layoustats
> + CODE: FFLS3
> + """
> +
> + ls = [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 14996867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909, 336986104593],
> + [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 29996142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 29997293567, 670368077434],
> + [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 44997516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 44999096896, 1004056428600],
> + [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 59999263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232968, 1340163285214],
> + [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 74999204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158793, 1676193906267],
> + [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 89999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 90000994588, 2006906488984],
> + [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, 104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 104999171073, 2326727992588],
> + [15, 119998955819, 7282450432, 0, 7282565120, 1777970, 1777942, 119997580860, 1256367773033, 2422800384, 0, 2422947840, 591540, 591504, 119997110818, 2505949174550],
> + [15, 135001214228, 8745824256, 0, 8745967616, 2135246, 2135211, 134997748029, 1533711205067, 2909380608, 0, 2909499392, 710327, 710298, 134997968401, 2685788058781],
> + [15, 150001848989, 10061635584, 0, 10061713408, 2456473, 2456454, 150001424866, 1804805896489, 3347156992, 0, 3347341312, 817222, 817177, 149995808252, 2874291512120],
> + [15, 165001836108, 11362164736, 0, 11362275328, 2773993, 2773966, 165005067693, 2076605244488, 3779543040, 0, 3779670016, 922771, 922740, 164995855477, 3061852257235],
> + [15, 180001730982, 12640329728, 0, 12640501760, 3086060, 3086018, 180011161867, 2347355148422, 4205420544, 0, 4205617152, 1026762, 1026714, 179996197383, 3251253382615],
> + [15, 195001853422, 13948760064, 0, 13948923904, 3405499, 3405459, 195014210400, 2616834777877, 4640079872, 0, 4640284672, 1132882, 1132832, 194995075575, 3441205891439],
> + [15, 210001827412, 15221641216, 0, 15221850112, 3716272, 3716221, 210017036781, 2885570123254, 5063086080, 0, 5063245824, 1236144, 1236105, 209995166352, 3633629440629],
> + [15, 225002640050, 16503263232, 0, 16503443456, 4029161, 4029117, 225020732847, 3151617488721, 5488578560, 0, 5488766976, 1340031, 1339985, 224995997875, 3828628065972],
> + [15, 240002559016, 17793617920, 0, 17793802240, 4344190, 4344145, 240023809074, 3420932837821, 5920374784, 0, 5920559104, 1445449, 1445404, 239996196851, 4019614475366],
> + [15, 254992904467, 19104202752, 0, 19104456704, 4664174, 4664112, 255014147585, 3697365199651, 6356496384, 0, 6356742144, 1551939, 1551879, 254987550053, 4201845573926],
> + [15, 269992974924, 20424237056, 0, 20424503296, 4986451, 4986386, 270006876010, 3975685088077, 6795452416, 0, 6795685888, 1659103, 1659046, 269979042644, 4382373419098],
> + [15, 284994963767, 21704196096, 0, 21704466432, 5298942, 5298876, 285006594147, 4248404327871, 7221321728, 0, 7221551104, 1763074, 1763018, 284981200175, 4569336423310]]
> + _LayoutStats(t, env, ls)
> +
> +def testFlexLayoutStatsOverflow(t, env):
> + """These layoutstats are a write intensive work load in which eventually one stat takes
> + twice longer than the collection period.
> +
> + FLAGS: flex layoustats
> + CODE: FFLS4
> + """
> +
> + ls = [[27, 27614183359, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 96468992, 10292, 10240, 26609085208, 134047775590766],
> + [15, 42725368747, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2402213888, 15847, 11881, 31458638093, 136367242297571],
> + [15, 57912190475, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2406907904, 15924, 11881, 31458638093, 136367242297571],
> + [15, 72921814168, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 2946293760, 16847, 15969, 70391696445, 275087250172195],
> + [15, 87922239746, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 3196473344, 18335, 15969, 70391696445, 275087250172195],
> + [15, 102949476399, 0, 0, 0, 0, 0, 0, 0, 1808183296, 0, 4038545408, 20452, 19074, 92455324261, 310159328537298],
> + [15, 117951351182, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 4486782976, 22613, 19935, 116950745229, 331739899803911],
> + [16, 133017224561, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 4830961664, 23306, 22169, 118004988775, 353778424445917],
> + [15, 148031127154, 0, 0, 0, 0, 0, 0, 0, 4132970496, 0, 5960671232, 29861, 26094, 146128115965, 387064682636158],
> + [15, 163058556237, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 7550558208, 40590, 39198, 159139080717, 453635077855389],
> + [15, 178067770476, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 7838756864, 41554, 39198, 159139080717, 453635077855389],
> + [15, 193081456711, 0, 0, 0, 0, 0, 0, 0, 6428528640, 0, 8151494656, 43497, 42179, 189486399712, 517147615890054],
> + [15, 208082626131, 0, 0, 0, 0, 0, 0, 0, 7284596736, 0, 8656367616, 47929, 43079, 207082978313, 532741795045495],
> + [15, 223082643294, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9539055616, 58212, 53705, 222083467525, 636168303637199],
> + [15, 238083127306, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9763426304, 62673, 57863, 223491351125, 650450833313121],
> + [15, 253175262253, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9860571136, 65509, 57863, 223491351125, 650450833313121],
> + [15, 268185316876, 0, 0, 0, 0, 0, 0, 0, 8729772032, 0, 10523738112, 71014, 65222, 267165070170, 853839631006322],
> + [17, 285787666679, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 10779361280, 72612, 66965, 284787142241, 896650223319399],
> + [33, 318568880195, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 10779361280, 72613, 72611, 317562885639, 1120229814239633],
> + [15, 333747489171, 0, 0, 0, 0, 0, 0, 0, 10788278272, 0, 10788802560, 74918, 74790, 332233465692, 1121703181284495],
> + [15, 348749618256, 0, 0, 0, 0, 0, 0, 0, 10801360896, 0, 10801885184, 78112, 77984, 347235605251, 1123668237106158],
> + [14, 362014682745, 0, 0, 0, 0, 0, 0, 0, 10812923904, 0, 10814496768, 81191, 80935, 361134569864, 1125289046746198],
> + [15, 377016435231, 0, 0, 0, 0, 0, 0, 0, 10836291584, 0, 10837864448, 86896, 86640, 376136316640, 1127198465086932],
> + [15, 392027464946, 0, 0, 0, 0, 0, 0, 0, 10852364288, 0, 10853937152, 90820, 90564, 391147321463, 1129113173731145],
> + [15, 407034683097, 0, 0, 0, 0, 0, 0, 0, 10864914432, 0, 10866487296, 93884, 93628, 406154554429, 1131023767183211]]
> + _LayoutStats(t, env, ls)
> --
> 2.3.6
>

2016-11-28 18:01:42

by Tom Haynes

[permalink] [raw]
Subject: Re: [PATCH pynfs 12/12] Add layoutstats tests for flex files

On Mon, Nov 28, 2016 at 12:22:54PM -0500, J. Bruce Fields wrote:
> On Sat, Nov 26, 2016 at 10:26:41PM -0800, Tom Haynes wrote:
> > 1) Time series where the client resets the data
> > 2) Time series where the reset is straightened out
> > 3) Time series where an I/O stall occurs
>
> I can't really follow what this is doing, so I can't tell: will these
> tests be useful to anyone with a flexfiles server, or are they specific
> to your particular implementation and test configuration?

They will be useful to anyone with a flexfiles server which supports
LAYOUTSTATS. I.e., they are generated from the Linux client, which means
that they are following the standard.

I didn't pick any specific workload other than making sure that real data
over a period of time. As a matter of fact, I couldn't tell you what was
going on here, I just pulled them from the first set of traces I could
find sustained I/O.

So, yes, I think they will be useful.

fwiw - the tests could either read data from a file and/or have the
data files specified on the cli. I'd like that ability for my own testing,
but for here I just wanted to supply basic coverage.


>
> --b.
>
> >
> > Signed-off-by: Tom Haynes <[email protected]>
> > ---
> > nfs4.1/server41tests/st_flex.py | 195 +++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 194 insertions(+), 1 deletion(-)
> >
> > diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
> > index 06dbba8..a14c926 100644
> > --- a/nfs4.1/server41tests/st_flex.py
> > +++ b/nfs4.1/server41tests/st_flex.py
> > @@ -327,7 +327,7 @@ def testFlexLayoutStatsSmall(t, env):
> > 2) GETDEVINFO
> > 3) LAYOUTRETURN, CLOSE
> >
> > - FLAGS: flex
> > + FLAGS: flex layoutstats
> > CODE: FFLS1
> > """
> > lats = [93089, 107683, 112340, 113195, 130412, 138390, 140427, 158824, 193078, 201879, 391634, 404757, 2201181, 2232614, 2280089, 2296343, 2341763, 2392984, 3064546, 3070314]
> > @@ -399,3 +399,196 @@ def testFlexLayoutStatsSmall(t, env):
> > op.close(0, open_stateid)]
> > res = sess.compound(ops)
> > check(res)
> > +
> > +def _LayoutStats(t, env, stats):
> > + '''Loop over the provided layoutstats, sending them on in time
> > + '''
> > + sess = env.c1.new_pnfs_client_session(env.testname(t))
> > +
> > + # Create the file
> > + res = create_file(sess, env.testname(t))
> > + check(res)
> > + fh = res.resarray[-1].object
> > + open_stateid = res.resarray[-2].stateid
> > + lo_stateid = open_stateid
> > +
> > + ops = [op.putfh(fh),
> > + op.layoutget(False, LAYOUT4_FLEX_FILES,
> > + LAYOUTIOMODE4_RW,
> > + 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
> > + res = sess.compound(ops)
> > + check(res)
> > + lo_stateid = res.resarray[-1].logr_stateid
> > + check_seqid(lo_stateid, 1)
> > +
> > + layout = res.resarray[-1].logr_layout[-1]
> > + p = FlexUnpacker(layout.loc_body)
> > + opaque = p.unpack_ff_layout4()
> > + p.done()
> > +
> > + stats_hint = opaque.ffl_stats_collect_hint
> > +
> > + # Assume one mirror/storage device
> > + ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1]
> > +
> > + deviceid = ds.ffds_deviceid
> > +
> > + ops = [op.putfh(fh),
> > + op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)]
> > + res = sess.compound(ops)
> > + check(res)
> > +
> > + gda = res.resarray[-1].gdir_device_addr
> > +
> > + p = FlexUnpacker(gda.da_addr_body)
> > + da = p.unpack_ff_device_addr4()
> > + p.done()
> > +
> > + rd_io = io_info4()
> > + wr_io = io_info4()
> > +
> > + rd_lat = ff_io_latency4()
> > + wr_lat = ff_io_latency4()
> > +
> > + for s in stats:
> > + dur = get_nfstime(s[1])
> > +
> > + # Did not capture these in the gathered traces
> > + offset = 0
> > + file_length = 0xffffffffffffffff
> > + rd_io.ii_count = 0
> > + rd_io.ii_bytes = 0
> > + wr_io.ii_count = 0
> > + wr_io.ii_bytes = 0
> > +
> > + rd_lat.ffil_ops_requested = s[5]
> > + rd_lat.ffil_bytes_requested = s[4]
> > + rd_lat.ffil_ops_completed = s[6]
> > + rd_lat.ffil_bytes_completed = s[2]
> > + rd_lat.ffil_bytes_not_delivered = s[3]
> > + rd_lat.ffil_total_busy_time = get_nfstime(s[7])
> > + rd_lat.ffil_aggregate_completion_time = get_nfstime(s[8])
> > + wr_lat.ffil_ops_requested = s[12]
> > + wr_lat.ffil_bytes_requested = s[11]
> > + wr_lat.ffil_ops_completed = s[13]
> > + wr_lat.ffil_bytes_completed = s[9]
> > + wr_lat.ffil_bytes_not_delivered = s[10]
> > + wr_lat.ffil_total_busy_time = get_nfstime(s[14])
> > + wr_lat.ffil_aggregate_completion_time = get_nfstime(s[15])
> > +
> > + sleeper = s[0]
> > + env.sleep(sleeper)
> > + fflu = ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1],
> > + rd_lat, wr_lat, dur, True)
> > + p = FlexPacker()
> > + p.pack_ff_layoutupdate4(fflu)
> > + lu4 = layoutupdate4(LAYOUT4_FLEX_FILES, p.get_buffer())
> > +
> > + ops = [op.putfh(fh),
> > + op.layoutstats(offset, file_length, lo_stateid, rd_io, wr_io, deviceid, lu4)]
> > + res = sess.compound(ops)
> > + check(res)
> > +
> > + ops = [op.putfh(fh),
> > + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> > + layoutreturn4(LAYOUTRETURN4_FILE,
> > + layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
> > + res = sess.compound(ops)
> > + check(res)
> > + res = close_file(sess, fh, stateid=open_stateid)
> > + check(res)
> > +
> > +def testFlexLayoutStatsReset(t, env):
> > + """These layoutstats are from when the client effectively resets them
> > + by having one field be less than the cumulative ancestor
> > +
> > + FLAGS: flex layoustats
> > + CODE: FFLS2
> > + """
> > +
> > + ls = [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 14996867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909, 336986104593],
> > + [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 29996142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 29997293567, 670368077434],
> > + [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 44997516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 44999096896, 1004056428600],
> > + [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 59999263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232968, 1340163285214],
> > + [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 74999204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158793, 1676193906267],
> > + [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 89999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 90000994588, 2006906488984],
> > + [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, 104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 104999171073, 2326727992588],
> > + [15, 14997245247, 1466019840, 0, 1466097664, 357934, 357915, 15001797989, 277140995467, 487624704, 0, 487677952, 119062, 119049, 14997939745, 179221181962],
> > + [15, 29999503656, 2929393664, 0, 2929500160, 715210, 715184, 30001965158, 554484427501, 974204928, 0, 974229504, 237849, 237843, 29998797328, 359060066193],
> > + [15, 45000138417, 4245204992, 0, 4245245952, 1036437, 1036427, 45005641995, 825579118923, 1411981312, 0, 1412071424, 344744, 344722, 44996637179, 547563519532],
> > + [15, 60000125536, 5545734144, 0, 5545807872, 1353957, 1353939, 60009284822, 1097378466922, 1844367360, 0, 1844400128, 450293, 450285, 59996684404, 735124264647],
> > + [15, 14999894874, 1278164992, 0, 1278226432, 312067, 312052, 15006094174, 270749903934, 425877504, 0, 425947136, 103991, 103974, 15000341906, 189401125380],
> > + [15, 30000017314, 2586595328, 0, 2586648576, 631506, 631493, 30009142707, 540229533389, 860536832, 0, 860614656, 210111, 210092, 29999220098, 379353634204],
> > + [15, 44999991304, 3859476480, 0, 3859574784, 942279, 942255, 45011969088, 808964878766, 1283543040, 0, 1283575808, 313373, 313365, 44999310875, 571777183394],
> > + [15, 60000803942, 5141098496, 0, 5141168128, 1255168, 1255151, 60015665154, 1075012244233, 1709035520, 0, 1709096960, 417260, 417245, 60000142398, 766775808737],
> > + [15, 75000722908, 6431453184, 0, 6431526912, 1570197, 1570179, 75018741381, 1344327593333, 2140831744, 0, 2140889088, 522678, 522664, 75000341374, 957762218131],
> > + [15, 14990345451, 1310584832, 0, 1310654464, 319984, 319967, 14990338511, 276432361830, 436121600, 0, 436183040, 106490, 106475, 14991353202, 182231098560],
> > + [15, 29990415908, 2630619136, 0, 2630701056, 642261, 642241, 29983066936, 554752250256, 875077632, 0, 875126784, 213654, 213642, 29982845793, 362758943732],
> > + [15, 44992404751, 3910578176, 0, 3910664192, 954752, 954731, 44982785073, 827471490050, 1300946944, 0, 1300992000, 317625, 317614, 44985003324, 549721947944]]
> > +
> > + _LayoutStats(t, env, ls)
> > +
> > +def testFlexLayoutStatsStraight(t, env):
> > + """These stats are the same as the reset ones, but have been massaged
> > + to keep the server from detecting the reset. I.e., the client
> > + has not lost it all!
> > +
> > + FLAGS: flex layoustats
> > + CODE: FFLS3
> > + """
> > +
> > + ls = [[15, 14997377109, 756789248, 0, 756834304, 184774, 184763, 14996867426, 135877046309, 252579840, 0, 252665856, 61686, 61665, 14997307909, 336986104593],
> > + [15, 29997404625, 1527537664, 0, 1527566336, 372941, 372934, 29996142132, 275416132139, 508502016, 0, 508604416, 124171, 124146, 29997293567, 670368077434],
> > + [15, 44999356031, 2331115520, 0, 2331136000, 569125, 569120, 44997516473, 414235887583, 775569408, 0, 775680000, 189375, 189348, 44999096896, 1004056428600],
> > + [15, 60001513873, 3142483968, 0, 3142529024, 767219, 767208, 59999263507, 550956049466, 1044996096, 0, 1045082112, 255147, 255126, 60001232968, 1340163285214],
> > + [15, 75001564615, 3969384448, 0, 3969413120, 969095, 969088, 74999204445, 687761120289, 1320456192, 0, 1320542208, 322398, 322377, 75001158793, 1676193906267],
> > + [15, 90001651970, 4873195520, 0, 4873248768, 1189758, 1189745, 89999194540, 828644696229, 1620467712, 0, 1620545536, 395641, 395622, 90000994588, 2006906488984],
> > + [15, 105001710572, 5816430592, 0, 5816467456, 1420036, 1420027, 104995782871, 979226777566, 1935175680, 0, 1935269888, 472478, 472455, 104999171073, 2326727992588],
> > + [15, 119998955819, 7282450432, 0, 7282565120, 1777970, 1777942, 119997580860, 1256367773033, 2422800384, 0, 2422947840, 591540, 591504, 119997110818, 2505949174550],
> > + [15, 135001214228, 8745824256, 0, 8745967616, 2135246, 2135211, 134997748029, 1533711205067, 2909380608, 0, 2909499392, 710327, 710298, 134997968401, 2685788058781],
> > + [15, 150001848989, 10061635584, 0, 10061713408, 2456473, 2456454, 150001424866, 1804805896489, 3347156992, 0, 3347341312, 817222, 817177, 149995808252, 2874291512120],
> > + [15, 165001836108, 11362164736, 0, 11362275328, 2773993, 2773966, 165005067693, 2076605244488, 3779543040, 0, 3779670016, 922771, 922740, 164995855477, 3061852257235],
> > + [15, 180001730982, 12640329728, 0, 12640501760, 3086060, 3086018, 180011161867, 2347355148422, 4205420544, 0, 4205617152, 1026762, 1026714, 179996197383, 3251253382615],
> > + [15, 195001853422, 13948760064, 0, 13948923904, 3405499, 3405459, 195014210400, 2616834777877, 4640079872, 0, 4640284672, 1132882, 1132832, 194995075575, 3441205891439],
> > + [15, 210001827412, 15221641216, 0, 15221850112, 3716272, 3716221, 210017036781, 2885570123254, 5063086080, 0, 5063245824, 1236144, 1236105, 209995166352, 3633629440629],
> > + [15, 225002640050, 16503263232, 0, 16503443456, 4029161, 4029117, 225020732847, 3151617488721, 5488578560, 0, 5488766976, 1340031, 1339985, 224995997875, 3828628065972],
> > + [15, 240002559016, 17793617920, 0, 17793802240, 4344190, 4344145, 240023809074, 3420932837821, 5920374784, 0, 5920559104, 1445449, 1445404, 239996196851, 4019614475366],
> > + [15, 254992904467, 19104202752, 0, 19104456704, 4664174, 4664112, 255014147585, 3697365199651, 6356496384, 0, 6356742144, 1551939, 1551879, 254987550053, 4201845573926],
> > + [15, 269992974924, 20424237056, 0, 20424503296, 4986451, 4986386, 270006876010, 3975685088077, 6795452416, 0, 6795685888, 1659103, 1659046, 269979042644, 4382373419098],
> > + [15, 284994963767, 21704196096, 0, 21704466432, 5298942, 5298876, 285006594147, 4248404327871, 7221321728, 0, 7221551104, 1763074, 1763018, 284981200175, 4569336423310]]
> > + _LayoutStats(t, env, ls)
> > +
> > +def testFlexLayoutStatsOverflow(t, env):
> > + """These layoutstats are a write intensive work load in which eventually one stat takes
> > + twice longer than the collection period.
> > +
> > + FLAGS: flex layoustats
> > + CODE: FFLS4
> > + """
> > +
> > + ls = [[27, 27614183359, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 96468992, 10292, 10240, 26609085208, 134047775590766],
> > + [15, 42725368747, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2402213888, 15847, 11881, 31458638093, 136367242297571],
> > + [15, 57912190475, 0, 0, 0, 0, 0, 0, 0, 41943040, 0, 2406907904, 15924, 11881, 31458638093, 136367242297571],
> > + [15, 72921814168, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 2946293760, 16847, 15969, 70391696445, 275087250172195],
> > + [15, 87922239746, 0, 0, 0, 0, 0, 0, 0, 896532480, 0, 3196473344, 18335, 15969, 70391696445, 275087250172195],
> > + [15, 102949476399, 0, 0, 0, 0, 0, 0, 0, 1808183296, 0, 4038545408, 20452, 19074, 92455324261, 310159328537298],
> > + [15, 117951351182, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 4486782976, 22613, 19935, 116950745229, 331739899803911],
> > + [16, 133017224561, 0, 0, 0, 0, 0, 0, 0, 2587693056, 0, 4830961664, 23306, 22169, 118004988775, 353778424445917],
> > + [15, 148031127154, 0, 0, 0, 0, 0, 0, 0, 4132970496, 0, 5960671232, 29861, 26094, 146128115965, 387064682636158],
> > + [15, 163058556237, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 7550558208, 40590, 39198, 159139080717, 453635077855389],
> > + [15, 178067770476, 0, 0, 0, 0, 0, 0, 0, 5614419968, 0, 7838756864, 41554, 39198, 159139080717, 453635077855389],
> > + [15, 193081456711, 0, 0, 0, 0, 0, 0, 0, 6428528640, 0, 8151494656, 43497, 42179, 189486399712, 517147615890054],
> > + [15, 208082626131, 0, 0, 0, 0, 0, 0, 0, 7284596736, 0, 8656367616, 47929, 43079, 207082978313, 532741795045495],
> > + [15, 223082643294, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9539055616, 58212, 53705, 222083467525, 636168303637199],
> > + [15, 238083127306, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9763426304, 62673, 57863, 223491351125, 650450833313121],
> > + [15, 253175262253, 0, 0, 0, 0, 0, 0, 0, 7944978432, 0, 9860571136, 65509, 57863, 223491351125, 650450833313121],
> > + [15, 268185316876, 0, 0, 0, 0, 0, 0, 0, 8729772032, 0, 10523738112, 71014, 65222, 267165070170, 853839631006322],
> > + [17, 285787666679, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 10779361280, 72612, 66965, 284787142241, 896650223319399],
> > + [33, 318568880195, 0, 0, 0, 0, 0, 0, 0, 9522692096, 0, 10779361280, 72613, 72611, 317562885639, 1120229814239633],
> > + [15, 333747489171, 0, 0, 0, 0, 0, 0, 0, 10788278272, 0, 10788802560, 74918, 74790, 332233465692, 1121703181284495],
> > + [15, 348749618256, 0, 0, 0, 0, 0, 0, 0, 10801360896, 0, 10801885184, 78112, 77984, 347235605251, 1123668237106158],
> > + [14, 362014682745, 0, 0, 0, 0, 0, 0, 0, 10812923904, 0, 10814496768, 81191, 80935, 361134569864, 1125289046746198],
> > + [15, 377016435231, 0, 0, 0, 0, 0, 0, 0, 10836291584, 0, 10837864448, 86896, 86640, 376136316640, 1127198465086932],
> > + [15, 392027464946, 0, 0, 0, 0, 0, 0, 0, 10852364288, 0, 10853937152, 90820, 90564, 391147321463, 1129113173731145],
> > + [15, 407034683097, 0, 0, 0, 0, 0, 0, 0, 10864914432, 0, 10866487296, 93884, 93628, 406154554429, 1131023767183211]]
> > + _LayoutStats(t, env, ls)
> > --
> > 2.3.6
> >
> --
> 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

2016-11-28 21:47:53

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Mon, Nov 28, 2016 at 11:33:21AM -0500, J. Bruce Fields wrote:
> On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > I wanted to add client support for the flex file layout.
> >
> > Note, I did not add pynfs as a flag because I didn't want to
> > mess up with any existing uses of it.
> >
> > The other major change here is in closing all opened
> > files and destroying all clientids. With all the tests
> > which run against my server, there are no longer any
> > open files. There are however 11 clientids remaining.
> >
> > I will track those down.
> >
> > fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.git
>
> Thanks! I'll try these and take a look.

It breaks all the 4.0 tests:

ACC3 st_access.testNoFh : FAILURE
AttributeError: 'Environment' object has no attribute
'clean_clients'

The problem is that nfs4.1/testmod.py is used by 4.0 as well, but
there's not a 4.0 version of clean_clients.... Simplest I guess is to do
as with clean_sessions and define a dummy method.

--b.

diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
index 6fe083a..221c3ed 100644
--- a/nfs4.0/servertests/environment.py
+++ b/nfs4.0/servertests/environment.py
@@ -229,6 +229,9 @@ class Environment(testmod.Environment):
def clean_sessions(self):
return

+ def clean_clients(self):
+ return
+
#########################################
debug_fail = False

2016-11-28 23:38:37

by Tom Haynes

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Mon, Nov 28, 2016 at 04:47:25PM -0500, J. Bruce Fields wrote:
> On Mon, Nov 28, 2016 at 11:33:21AM -0500, J. Bruce Fields wrote:
> > On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > > I wanted to add client support for the flex file layout.
> > >
> > > Note, I did not add pynfs as a flag because I didn't want to
> > > mess up with any existing uses of it.
> > >
> > > The other major change here is in closing all opened
> > > files and destroying all clientids. With all the tests
> > > which run against my server, there are no longer any
> > > open files. There are however 11 clientids remaining.
> > >
> > > I will track those down.
> > >
> > > fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.git
> >
> > Thanks! I'll try these and take a look.
>
> It breaks all the 4.0 tests:
>
> ACC3 st_access.testNoFh : FAILURE
> AttributeError: 'Environment' object has no attribute
> 'clean_clients'
>
> The problem is that nfs4.1/testmod.py is used by 4.0 as well, but
> there's not a 4.0 version of clean_clients.... Simplest I guess is to do
> as with clean_sessions and define a dummy method.
>
> --b.
>
> diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
> index 6fe083a..221c3ed 100644
> --- a/nfs4.0/servertests/environment.py
> +++ b/nfs4.0/servertests/environment.py
> @@ -229,6 +229,9 @@ class Environment(testmod.Environment):
> def clean_sessions(self):
> return
>
> + def clean_clients(self):
> + return
> +
> #########################################
> debug_fail = False

Yeah, I never run 4.0 tests. Do you want me to add it to the patchset and
resubmit?


> --
> 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

2016-11-29 01:55:55

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Mon, Nov 28, 2016 at 03:38:31PM -0800, Tom Haynes wrote:
> On Mon, Nov 28, 2016 at 04:47:25PM -0500, J. Bruce Fields wrote:
> > On Mon, Nov 28, 2016 at 11:33:21AM -0500, J. Bruce Fields wrote:
> > > On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > > > I wanted to add client support for the flex file layout.
> > > >
> > > > Note, I did not add pynfs as a flag because I didn't want to
> > > > mess up with any existing uses of it.
> > > >
> > > > The other major change here is in closing all opened
> > > > files and destroying all clientids. With all the tests
> > > > which run against my server, there are no longer any
> > > > open files. There are however 11 clientids remaining.
> > > >
> > > > I will track those down.
> > > >
> > > > fwiw - these are in my staging branch at git://linux-nfs.org/~loghyr/pynfs.git
> > >
> > > Thanks! I'll try these and take a look.
> >
> > It breaks all the 4.0 tests:
> >
> > ACC3 st_access.testNoFh : FAILURE
> > AttributeError: 'Environment' object has no attribute
> > 'clean_clients'
> >
> > The problem is that nfs4.1/testmod.py is used by 4.0 as well, but
> > there's not a 4.0 version of clean_clients.... Simplest I guess is to do
> > as with clean_sessions and define a dummy method.
> >
> > --b.
> >
> > diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
> > index 6fe083a..221c3ed 100644
> > --- a/nfs4.0/servertests/environment.py
> > +++ b/nfs4.0/servertests/environment.py
> > @@ -229,6 +229,9 @@ class Environment(testmod.Environment):
> > def clean_sessions(self):
> > return
> >
> > + def clean_clients(self):
> > + return
> > +
> > #########################################
> > debug_fail = False
>
> Yeah, I never run 4.0 tests. Do you want me to add it to the patchset and
> resubmit?

I've just added that patch and pushed it out. Thanks!

--b.

2016-11-29 23:51:57

by Frank Filz

[permalink] [raw]
Subject: RE: [PATCH pynfs 00/12] Flex File support



> -----Original Message-----
> From: [email protected] [mailto:linux-nfs-
> [email protected]] On Behalf Of J. Bruce Fields
> Sent: Monday, November 28, 2016 8:33 AM
> To: Tom Haynes <[email protected]>
> Cc: Linux NFS Mailing list <[email protected]>
> Subject: Re: [PATCH pynfs 00/12] Flex File support
>
> On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > I wanted to add client support for the flex file layout.
> >
> > Note, I did not add pynfs as a flag because I didn't want to mess up
> > with any existing uses of it.
> >
> > The other major change here is in closing all opened files and
> > destroying all clientids. With all the tests which run against my
> > server, there are no longer any open files. There are however 11
> > clientids remaining.
> >
> > I will track those down.
> >
> > fwiw - these are in my staging branch at
> > git://linux-nfs.org/~loghyr/pynfs.git
>
> Thanks! I'll try these and take a look.
>
> How did you notice all the leftover state? I run with a pretty short
lease time
> (to speed testing), so I guess the leftover state must expire too quickly
to
> cause me problems.
>
> Anyway it's good to have that cleaned up.

Not closing files and releasing clientids at least in the 4.0 tests has
actually shaken out bugs in Ganesha...

But maybe that kind of thing should be an explicit test, create lots of
clientids/sessions, and then wait for them all to expire and see if the
server can handle all the activity.

Frank


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


2016-11-30 14:24:20

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH pynfs 00/12] Flex File support

On Tue, Nov 29, 2016 at 03:44:48PM -0800, Frank Filz wrote:
>
>
> > -----Original Message-----
> > From: [email protected] [mailto:linux-nfs-
> > [email protected]] On Behalf Of J. Bruce Fields
> > Sent: Monday, November 28, 2016 8:33 AM
> > To: Tom Haynes <[email protected]>
> > Cc: Linux NFS Mailing list <[email protected]>
> > Subject: Re: [PATCH pynfs 00/12] Flex File support
> >
> > On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > > I wanted to add client support for the flex file layout.
> > >
> > > Note, I did not add pynfs as a flag because I didn't want to mess up
> > > with any existing uses of it.
> > >
> > > The other major change here is in closing all opened files and
> > > destroying all clientids. With all the tests which run against my
> > > server, there are no longer any open files. There are however 11
> > > clientids remaining.
> > >
> > > I will track those down.
> > >
> > > fwiw - these are in my staging branch at
> > > git://linux-nfs.org/~loghyr/pynfs.git
> >
> > Thanks! I'll try these and take a look.
> >
> > How did you notice all the leftover state? I run with a pretty short
> lease time
> > (to speed testing), so I guess the leftover state must expire too quickly
> to
> > cause me problems.
> >
> > Anyway it's good to have that cleaned up.
>
> Not closing files and releasing clientids at least in the 4.0 tests has
> actually shaken out bugs in Ganesha...
>
> But maybe that kind of thing should be an explicit test, create lots of
> clientids/sessions, and then wait for them all to expire and see if the
> server can handle all the activity.

Yes, probably so.

I seem to recall this not being the first time this has caused problems
for people with test scripts that try to unmount immediately after
running pynfs.

--b.

2016-11-30 16:56:56

by Frank Filz

[permalink] [raw]
Subject: RE: [PATCH pynfs 00/12] Flex File support

> > > -----Original Message-----
> > > From: [email protected] [mailto:linux-nfs-
> > > [email protected]] On Behalf Of J. Bruce Fields
> > > Sent: Monday, November 28, 2016 8:33 AM
> > > To: Tom Haynes <[email protected]>
> > > Cc: Linux NFS Mailing list <[email protected]>
> > > Subject: Re: [PATCH pynfs 00/12] Flex File support
> > >
> > > On Sat, Nov 26, 2016 at 10:26:29PM -0800, Tom Haynes wrote:
> > > > I wanted to add client support for the flex file layout.
> > > >
> > > > Note, I did not add pynfs as a flag because I didn't want to mess
> > > > up with any existing uses of it.
> > > >
> > > > The other major change here is in closing all opened files and
> > > > destroying all clientids. With all the tests which run against my
> > > > server, there are no longer any open files. There are however 11
> > > > clientids remaining.
> > > >
> > > > I will track those down.
> > > >
> > > > fwiw - these are in my staging branch at
> > > > git://linux-nfs.org/~loghyr/pynfs.git
> > >
> > > Thanks! I'll try these and take a look.
> > >
> > > How did you notice all the leftover state? I run with a pretty
> > > short
> > lease time
> > > (to speed testing), so I guess the leftover state must expire too
> > > quickly
> > to
> > > cause me problems.
> > >
> > > Anyway it's good to have that cleaned up.
> >
> > Not closing files and releasing clientids at least in the 4.0 tests
> > has actually shaken out bugs in Ganesha...
> >
> > But maybe that kind of thing should be an explicit test, create lots
> > of clientids/sessions, and then wait for them all to expire and see if
> > the server can handle all the activity.
>
> Yes, probably so.
>
> I seem to recall this not being the first time this has caused problems
for
> people with test scripts that try to unmount immediately after running
pynfs.

Yea... One option would be for pynfs to delay for the lease period (or maybe
twice the lease period) after the last test.

One nice thing (and now that you mention it, I'm pretty sure we've had this
conversation before) about the status quo is that the lease expiry for
earlier tests happens in the middle of other tests. Maybe not so nice an
deterministic for the test suite, but great at exposing issues...

Frank


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus