From: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Subject: [PATCH 2/2] handle NFS4ERR_BAD_STATEID on setattr
Date: Thu, 19 May 2016 17:32:51 +0200 [thread overview]
Message-ID: <1463671971-5085-2-git-send-email-tigran.mkrtchyan@desy.de> (raw)
In-Reply-To: <1463671971-5085-1-git-send-email-tigran.mkrtchyan@desy.de>
the st_setattr test expect that setting a size for not file objects
will return NFS4ERR_INVAL, nevertheless, as setting a size requires
a valid open/lock state id, server may check that first and return
NFS4ERR_BAD_STATEID, which is not handled by the test case.
this change adds NFS4ERR_BAD_STATEID into the list of expected
errors.
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
nfs4.0/servertests/st_setattr.py | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py
index 5e9c4e9..912707d 100644
--- a/nfs4.0/servertests/st_setattr.py
+++ b/nfs4.0/servertests/st_setattr.py
@@ -544,7 +544,7 @@ def testUnsupportedSocket(t, env):
_try_unsupported(t, env, path)
def testSizeDir(t, env):
- """SETATTR(_SIZE) of a directory should return NFS4ERR_ISDIR
+ """SETATTR(_SIZE) of a directory should return NFS4ERR_ISDIR or NFS4ERR_BAD_STATEID
FLAGS: setattr dir all
DEPEND: MKDIR
@@ -556,10 +556,10 @@ def testSizeDir(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, NFS4ERR_ISDIR, "SETATTR(_SIZE) of a directory")
+ check(res, [NFS4ERR_ISDIR, NFS4ERR_BAD_STATEID], "SETATTR(_SIZE) of a directory")
def testSizeLink(t, env):
- """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL
+ """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID
FLAGS: setattr symlink all
DEPEND: MKLINK
@@ -571,11 +571,11 @@ def testSizeLink(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, [NFS4ERR_INVAL, NFS4ERR_SYMLINK],
+ check(res, [NFS4ERR_INVAL, NFS4ERR_SYMLINK, NFS4ERR_BAD_STATEID],
"SETATTR(FATTR4_SIZE) of a symlink")
def testSizeBlock(t, env):
- """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL
+ """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID
FLAGS: setattr block all
DEPEND: MKBLK
@@ -587,10 +587,10 @@ def testSizeBlock(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a block device")
+ check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a block device")
def testSizeChar(t, env):
- """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL
+ """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID
FLAGS: setattr char all
DEPEND: MKCHAR
@@ -602,10 +602,10 @@ def testSizeChar(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a character device")
+ check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a character device")
def testSizeFifo(t, env):
- """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL
+ """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID
FLAGS: setattr fifo all
DEPEND: MKFIFO
@@ -617,10 +617,10 @@ def testSizeFifo(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a fifo")
+ check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a fifo")
def testSizeSocket(t, env):
- """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL
+ """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID
FLAGS: setattr socket all
DEPEND: MKSOCK
@@ -632,7 +632,7 @@ def testSizeSocket(t, env):
check(res)
ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})]
res = c.compound(ops)
- check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a socket")
+ check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a socket")
def testInodeLocking(t, env):
"""SETATTR: This causes printk message due to inode locking bug
--
2.5.5
next prev parent reply other threads:[~2016-05-19 15:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 15:32 [PATCH 1/2] reduce code duplication Tigran Mkrtchyan
2016-05-19 15:32 ` Tigran Mkrtchyan [this message]
2016-06-13 19:21 ` [PATCH 2/2] handle NFS4ERR_BAD_STATEID on setattr J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463671971-5085-2-git-send-email-tigran.mkrtchyan@desy.de \
--to=tigran.mkrtchyan@desy.de \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).