linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nfs4lib: update do_getattr to use root_fh if no fh provided
@ 2017-01-10 12:02 Tigran Mkrtchyan
  2017-01-10 12:02 ` [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize Tigran Mkrtchyan
  0 siblings, 1 reply; 3+ messages in thread
From: Tigran Mkrtchyan @ 2017-01-10 12:02 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, Tigran Mkrtchyan

do_getattr(FATTR4_XX) is now equal to do_getattr(FATTR4_XX, root_fh)
The use_obj is updated to return putrootfh operation if file object
is not provided.

This looks like safe change as do_getattr(attr, None) was broken
(c.homedir variable never exist), thus was never used.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 nfs4.0/nfs4lib.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index 5031feb..8bda72a 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -489,7 +489,7 @@ class NFS4Client(rpc.RPCClient, nfs4_ops.NFS4Operations):
     def use_obj(self, file):
         """File is either None, a fh, or a list of path components"""
         if file is None or file == [None]:
-            return []
+            return [self.putrootfh_op()]
         elif type(file) is str:
             return [self.putfh_op(file)]
         else:
@@ -505,7 +505,6 @@ class NFS4Client(rpc.RPCClient, nfs4_ops.NFS4Operations):
 
 
     def do_getattr(self, attr, file=None):
-        if file is None: file = c.homedir
         d = self.do_getattrdict(file, [attr])
         if attr in d:
             return d[attr]
-- 
2.9.3


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

* [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize
  2017-01-10 12:02 [PATCH 1/2] nfs4lib: update do_getattr to use root_fh if no fh provided Tigran Mkrtchyan
@ 2017-01-10 12:02 ` Tigran Mkrtchyan
  2017-01-11 14:27   ` Mkrtchyan, Tigran
  0 siblings, 1 reply; 3+ messages in thread
From: Tigran Mkrtchyan @ 2017-01-10 12:02 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, Tigran Mkrtchyan

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 nfs4.0/servertests/st_write.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py
index 710452e..3781210 100644
--- a/nfs4.0/servertests/st_write.py
+++ b/nfs4.0/servertests/st_write.py
@@ -499,3 +499,20 @@ def testStolenStateid(t, env):
     res = c.write_file(fh, _text, stateid=stateid)
     c.security=security
     check(res, [NFS4ERR_ACCESS, NFS4ERR_PERM], "WRITE with stolen stateid")
+
+def testWriteOffsetOverflow(t, env):
+    """WRITE with offset + length bigger than UINT64_MAX
+
+    FLAGS: write all
+    DEPEND: MKFILE
+    CODE: WRT20
+    """
+    c = env.c1
+    c.init_connection()
+
+    max_filesize = c.do_getattr(FATTR4_MAXFILESIZE)
+    fh, stateid = c.create_confirm(t.code)
+    data = "abcde"
+
+    res = c.write_file(fh, data, max_filesize - 1, stateid)
+    check(res, NFS4ERR_INVAL, msg="WRITE with offset + length bigger than UINT64_MAX")
-- 
2.9.3


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

* Re: [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize
  2017-01-10 12:02 ` [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize Tigran Mkrtchyan
@ 2017-01-11 14:27   ` Mkrtchyan, Tigran
  0 siblings, 0 replies; 3+ messages in thread
From: Mkrtchyan, Tigran @ 2017-01-11 14:27 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs

Bruce & Co.

Please ignore this patches, as they break some other test.
I will resubmit new test of patches.

Tigran.

----- Original Message -----
> From: "Tigran Mkrtchyan" <tigran.mkrtchyan@desy.de>
> To: bfields@fieldses.org
> Cc: linux-nfs@vger.kernel.org, "Tigran Mkrtchyan" <tigran.mkrtchyan@desy.de>
> Sent: Tuesday, January 10, 2017 1:02:29 PM
> Subject: [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize

> Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
> ---
> nfs4.0/servertests/st_write.py | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
> 
> diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py
> index 710452e..3781210 100644
> --- a/nfs4.0/servertests/st_write.py
> +++ b/nfs4.0/servertests/st_write.py
> @@ -499,3 +499,20 @@ def testStolenStateid(t, env):
>     res = c.write_file(fh, _text, stateid=stateid)
>     c.security=security
>     check(res, [NFS4ERR_ACCESS, NFS4ERR_PERM], "WRITE with stolen stateid")
> +
> +def testWriteOffsetOverflow(t, env):
> +    """WRITE with offset + length bigger than UINT64_MAX
> +
> +    FLAGS: write all
> +    DEPEND: MKFILE
> +    CODE: WRT20
> +    """
> +    c = env.c1
> +    c.init_connection()
> +
> +    max_filesize = c.do_getattr(FATTR4_MAXFILESIZE)
> +    fh, stateid = c.create_confirm(t.code)
> +    data = "abcde"
> +
> +    res = c.write_file(fh, data, max_filesize - 1, stateid)
> +    check(res, NFS4ERR_INVAL, msg="WRITE with offset + length bigger than
> UINT64_MAX")
> --
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-01-11 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-10 12:02 [PATCH 1/2] nfs4lib: update do_getattr to use root_fh if no fh provided Tigran Mkrtchyan
2017-01-10 12:02 ` [PATCH 2/2] st_write: test server behavior on WRITE with offset+len > maxfilesize Tigran Mkrtchyan
2017-01-11 14:27   ` Mkrtchyan, Tigran

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