more server pynfs tests
Subsystems (2)
Just a couple more tests that I needed while tracking down a bug. Also available as usual from
git://linux-nfs.org/~bfields/pynfs.git master
--b.
PATCH 1/2 read+write+readwrite open test
--- nfs4.0/lib/nfs4/servertests/st_open.py | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
nfs4.0/lib/nfs4/servertests/st_open.py +26 -0
@@ -566,4 +566,30 @@ def testDenyWrite4(t, env): t.fail("READ returned %s, expected 'data'" % repr(res2.data)) +def testUpgrades(t, env): + """OPEN read, write, and read-write, then close + + Inspired by a linux nfsd regression: the final close closes all the + opens, and nfsd did that right, but some misaccounting somewhere + leaked a file reference with the result that the filesystem would be + unmountable after running this test. + + FLAGS: open all + DEPEND: MKFILE + CODE: OPEN29 + """ + c = env.c1 + c.init_connection() + file = c.homedir + [t.code] + c.create_confirm('owner1', file, access=OPEN4_SHARE_ACCESS_READ, + deny=OPEN4_SHARE_DENY_NONE) + c.open_file('owner1', file, access=OPEN4_SHARE_ACCESS_WRITE, + deny=OPEN4_SHARE_DENY_NONE) + res = c.open_file('owner1', file, access=OPEN4_SHARE_ACCESS_BOTH, + deny=OPEN4_SHARE_DENY_NONE) + fh = res.resarray[-1].switch.switch.object + stateid = res.resarray[-2].switch.switch.stateid + c.close_file(t.code, fh, stateid) + + #FRED - dot test
Signature · 1 line
1.7.4.1
PATCH 2/2 check another odd linux server case
In reply to J. Bruce Fields--- nfs4.0/lib/nfs4/servertests/st_lock.py | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
nfs4.0/lib/nfs4/servertests/st_lock.py +17 -0
@@ -846,3 +846,20 @@ def xxtestLockowner2(t, env): self.ncl.lock_test(self.fh) self.ncl.lock_file(self.fh, self.stateid, error=[NFS4ERR_BAD_STATEID]) +def testOpenDowngradeLock(t, env): + """OPEN a file RW, then lock R, then downgrade to R, then unlock. + + FLAGS: lock all + DEPEND: MKFILE + CODE: LOCK23 + """ + c = env.c1 + c.init_connection() + fh, oldstateid = c.create_confirm(t.code, access=OPEN4_SHARE_ACCESS_READ, + deny=OPEN4_SHARE_DENY_NONE) + fh, stateid = c.open_confirm(t.code, access=OPEN4_SHARE_ACCESS_BOTH, + deny=OPEN4_SHARE_DENY_NONE) + res = c.lock_file(t.code, fh, stateid); + res = c.downgrade_file(t.code, fh, res.lockid, + access=OPEN4_SHARE_ACCESS_READ, + deny=OPEN4_SHARE_DENY_NONE)
Signature · 1 line
1.7.4.1