Linux NFS development
 help / color / mirror / Atom feed
* more server pynfs tests
@ 2011-08-08 22:39 J. Bruce Fields
  2011-08-08 22:40 ` [PATCH 1/2] read+write+readwrite open test J. Bruce Fields
  2011-08-08 22:40 ` [PATCH 2/2] check another odd linux server case J. Bruce Fields
  0 siblings, 2 replies; 3+ messages in thread
From: J. Bruce Fields @ 2011-08-08 22:39 UTC (permalink / raw)
  To: Fred Isaman; +Cc: linux-nfs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] read+write+readwrite open test
  2011-08-08 22:39 more server pynfs tests J. Bruce Fields
@ 2011-08-08 22:40 ` J. Bruce Fields
  2011-08-08 22:40 ` [PATCH 2/2] check another odd linux server case J. Bruce Fields
  1 sibling, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2011-08-08 22:40 UTC (permalink / raw)
  To: Fred Isaman; +Cc: linux-nfs, J. Bruce Fields

---
 nfs4.0/lib/nfs4/servertests/st_open.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/nfs4.0/lib/nfs4/servertests/st_open.py b/nfs4.0/lib/nfs4/servertests/st_open.py
index 1e5ec70..88134f1 100644
--- a/nfs4.0/lib/nfs4/servertests/st_open.py
+++ b/nfs4.0/lib/nfs4/servertests/st_open.py
@@ -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
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] check another odd linux server case
  2011-08-08 22:39 more server pynfs tests J. Bruce Fields
  2011-08-08 22:40 ` [PATCH 1/2] read+write+readwrite open test J. Bruce Fields
@ 2011-08-08 22:40 ` J. Bruce Fields
  1 sibling, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2011-08-08 22:40 UTC (permalink / raw)
  To: Fred Isaman; +Cc: linux-nfs, J. Bruce Fields

---
 nfs4.0/lib/nfs4/servertests/st_lock.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/nfs4.0/lib/nfs4/servertests/st_lock.py b/nfs4.0/lib/nfs4/servertests/st_lock.py
index 90b93ee..8be25cd 100644
--- a/nfs4.0/lib/nfs4/servertests/st_lock.py
+++ b/nfs4.0/lib/nfs4/servertests/st_lock.py
@@ -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)
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-08 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 22:39 more server pynfs tests J. Bruce Fields
2011-08-08 22:40 ` [PATCH 1/2] read+write+readwrite open test J. Bruce Fields
2011-08-08 22:40 ` [PATCH 2/2] check another odd linux server case J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox