All of lore.kernel.org
 help / color / mirror / Atom feed
* pynfs fixes from cthon
@ 2012-02-24  5:00 J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 1/5] 4.1 server tests: rename tests incorrectly using root dir J. Bruce Fields
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:00 UTC (permalink / raw)
  To: linux-nfs

This is a few fixes found while trying pynfs tests against servers at
connectathon.

--b.


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

* [PATCH 1/5] 4.1 server tests: rename tests incorrectly using root dir
  2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
@ 2012-02-24  5:00 ` J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 2/5] 4.1 server tests: maketree should not leave files open J. Bruce Fields
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:00 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Several of the rename tests were incorrectly creating objects in the
export root.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 nfs4.1/server41tests/st_rename.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/nfs4.1/server41tests/st_rename.py b/nfs4.1/server41tests/st_rename.py
index ed5dbb5..f706a1c 100644
--- a/nfs4.1/server41tests/st_rename.py
+++ b/nfs4.1/server41tests/st_rename.py
@@ -185,7 +185,7 @@ def testCfhFile(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.usefile + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
@@ -198,7 +198,7 @@ def testCfhLink(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.uselink + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
@@ -211,7 +211,7 @@ def testCfhBlock(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.useblock + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
@@ -224,7 +224,7 @@ def testCfhChar(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.usechar + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
@@ -237,7 +237,7 @@ def testCfhFifo(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.usefifo + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
@@ -250,7 +250,7 @@ def testCfhSocket(t, env):
     """
     name = env.testname(t)
     sess = env.c1.new_client_session(name)
-    res = create_obj(sess, [name])
+    res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.usesocket + [name])
     check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
-- 
1.7.7.6


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

* [PATCH 2/5] 4.1 server tests: maketree should not leave files open
  2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 1/5] 4.1 server tests: rename tests incorrectly using root dir J. Bruce Fields
@ 2012-02-24  5:00 ` J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 3/5] 4.1 server tests: add citation for COMP4b J. Bruce Fields
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:00 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

In particular this causes spurious failures against any server that does
not allow renames of open files.

There are probably many more places where we should really be doing
closes.

Note: it might also be interesting to do a purely informational test to
determine whether a server allows renames of open files.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 nfs4.1/server41tests/environment.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index e9d2237..2566274 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -550,6 +550,18 @@ def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
     return fh, res.resarray[-2].stateid
     return fh, openstateid
 
+def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+                   access=OPEN4_SHARE_ACCESS_BOTH,
+                   deny=OPEN4_SHARE_DENY_NONE,
+                   mode=GUARDED4):
+    """Create (using open) a regular file, confirm the open, and close
+
+    Returns the fhandle
+    """
+    fh, stateid = create_confirm(sess, owner, path, attrs, access, deny, mode)
+    close_file(sess, fh, stateid=stateid)
+    return fh;
+
 def _getname(owner, path):
     if path is None:
         return owner
@@ -580,7 +592,7 @@ def maketree(sess, tree, root=None, owner=None):
             check(res)
             maketree(sess, obj[1:], root + [obj[0]], owner)
         else:
-            create_confirm(sess, owner, root + [obj])
+            create_close(sess, owner, root + [obj])
 
 def lookup_obj(sess, path):
     compound = [op.putrootfh()]
-- 
1.7.7.6


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

* [PATCH 3/5] 4.1 server tests: add citation for COMP4b
  2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 1/5] 4.1 server tests: rename tests incorrectly using root dir J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 2/5] 4.1 server tests: maketree should not leave files open J. Bruce Fields
@ 2012-02-24  5:00 ` J. Bruce Fields
  2012-02-24  5:00 ` [PATCH 4/5] 4.1 server tests: allow SYMLINK error on rename J. Bruce Fields
  2012-02-24  5:01 ` [PATCH 5/5] 4.1 server tests: don't insist on 0-seqid trick in setup J. Bruce Fields
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:00 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 nfs4.1/server41tests/st_compound.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_compound.py b/nfs4.1/server41tests/st_compound.py
index d38f621..c6a5ea9 100644
--- a/nfs4.1/server41tests/st_compound.py
+++ b/nfs4.1/server41tests/st_compound.py
@@ -64,7 +64,7 @@ def testInvalidMinor(t, env):
 def testInvalidMinor2(t, env):
     """COMPOUND with invalid minor version returns NFS4ERR_MINOR_VERS_MISMATCH
 
-    even if using illegal opcode
+    even if using illegal opcode (rfc 5661 p. 399)
 
     FLAGS: compound all
     CODE: COMP4b
-- 
1.7.7.6


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

* [PATCH 4/5] 4.1 server tests: allow SYMLINK error on rename
  2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
                   ` (2 preceding siblings ...)
  2012-02-24  5:00 ` [PATCH 3/5] 4.1 server tests: add citation for COMP4b J. Bruce Fields
@ 2012-02-24  5:00 ` J. Bruce Fields
  2012-02-24  5:01 ` [PATCH 5/5] 4.1 server tests: don't insist on 0-seqid trick in setup J. Bruce Fields
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:00 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Yes, 5661 does say to return NOTDIR in this case.  But I can't figure
out why.  Elsewhere it's generally preferred to return the more specific
SYMLINK error.  This is a buggy-client case (since the source and target
dirs are referred to by filehandle, the client should generally know
whether it's dealing with a directory or not), so I don't see the point
of being really picky here.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 nfs4.1/server41tests/st_rename.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_rename.py b/nfs4.1/server41tests/st_rename.py
index f706a1c..cde8ffc 100644
--- a/nfs4.1/server41tests/st_rename.py
+++ b/nfs4.1/server41tests/st_rename.py
@@ -201,7 +201,8 @@ def testCfhLink(t, env):
     res = create_obj(sess, env.c1.homedir + [name])
     check(res)
     res = rename_obj(sess, env.c1.homedir + [name], env.opts.uselink + [name])
-    check(res, NFS4ERR_NOTDIR, "RENAME with non-dir <cfh>")
+    checklist(res, [NFS4ERR_NOTDIR, NFS4ERR_SYMLINK],
+                                "RENAME with non-dir <cfh>")
 
 def testCfhBlock(t, env):
     """RENAME with non-dir (cfh) should return NFS4ERR_NOTDIR
-- 
1.7.7.6


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

* [PATCH 5/5] 4.1 server tests: don't insist on 0-seqid trick in setup
  2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
                   ` (3 preceding siblings ...)
  2012-02-24  5:00 ` [PATCH 4/5] 4.1 server tests: allow SYMLINK error on rename J. Bruce Fields
@ 2012-02-24  5:01 ` J. Bruce Fields
  4 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2012-02-24  5:01 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

The 4.1 spec requires servers to handle stateid's with seqid field 0
(they have the special meaning of "use the latest stateid in this
stateid stream").

We've seen buggy or incomplete servers that don't handle this yet.

We *should* add a test for that.  But insisting on it (for no real
reason) during setup just prevents all the other tests from running
unnecessarily.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 nfs4.1/server41tests/environment.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 2566274..24e82cd 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -190,7 +190,7 @@ class Environment(testmod.Environment):
                 log.warning("could not create /%s" % '/'.join(path))
         # Make file-object in /tree
         fh, stateid = create_confirm(sess, 'maketree', tree + ['file'])
-        stateid.seqid = 0
+        # stateid.seqid = 0
         ops = [op.putfh(fh),
                op.write(stateid, 0, FILE_SYNC4, self.filedata)]
         res = sess.compound(ops)
-- 
1.7.7.6


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

end of thread, other threads:[~2012-02-24  5:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24  5:00 pynfs fixes from cthon J. Bruce Fields
2012-02-24  5:00 ` [PATCH 1/5] 4.1 server tests: rename tests incorrectly using root dir J. Bruce Fields
2012-02-24  5:00 ` [PATCH 2/5] 4.1 server tests: maketree should not leave files open J. Bruce Fields
2012-02-24  5:00 ` [PATCH 3/5] 4.1 server tests: add citation for COMP4b J. Bruce Fields
2012-02-24  5:00 ` [PATCH 4/5] 4.1 server tests: allow SYMLINK error on rename J. Bruce Fields
2012-02-24  5:01 ` [PATCH 5/5] 4.1 server tests: don't insist on 0-seqid trick in setup J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.