* [PATCH] nfsv4.0/read: Test the behavior of reading near OFFSET_MAX
@ 2022-02-05 17:05 Chuck Lever
2022-02-05 20:06 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Chuck Lever @ 2022-02-05 17:05 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs
On many systems, the internal representation of a file offset or
file size is a signed 64-bit value. NFS, however, uses an unsigned
value for these quantities. The server must convert incoming offsets
and file sizes properly or risk an underflow.
Add a test which exercises this corner case.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
nfs4.0/servertests/st_read.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/nfs4.0/servertests/st_read.py b/nfs4.0/servertests/st_read.py
index 1b27f5d06f2f..f75b753d61c7 100644
--- a/nfs4.0/servertests/st_read.py
+++ b/nfs4.0/servertests/st_read.py
@@ -91,6 +91,18 @@ def testLargeOffset(t, env):
check(res, msg="Reading file /%s" % b'/'.join(env.opts.usefile))
_compare(t, res, b'', True)
+def testVeryLargeOffset(t, env):
+ """READ with offset far outside file
+
+ FLAGS: read all
+ DEPEND: LOOKFILE
+ CODE: RD5a
+ """
+ c = env.c1
+ res = c.read_file(env.opts.usefile, 0x7ffffffffffffffc, 10)
+ check(res, msg="Reading file /%s" % b'/'.join(env.opts.usefile))
+ _compare(t, res, b'', True)
+
def testZeroCount(t, env):
"""READ with count=0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nfsv4.0/read: Test the behavior of reading near OFFSET_MAX
2022-02-05 17:05 [PATCH] nfsv4.0/read: Test the behavior of reading near OFFSET_MAX Chuck Lever
@ 2022-02-05 20:06 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2022-02-05 20:06 UTC (permalink / raw)
To: Chuck Lever; +Cc: linux-nfs
Applied, thanks!--b.
On Sat, Feb 05, 2022 at 12:05:29PM -0500, Chuck Lever wrote:
> On many systems, the internal representation of a file offset or
> file size is a signed 64-bit value. NFS, however, uses an unsigned
> value for these quantities. The server must convert incoming offsets
> and file sizes properly or risk an underflow.
>
> Add a test which exercises this corner case.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> nfs4.0/servertests/st_read.py | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/nfs4.0/servertests/st_read.py b/nfs4.0/servertests/st_read.py
> index 1b27f5d06f2f..f75b753d61c7 100644
> --- a/nfs4.0/servertests/st_read.py
> +++ b/nfs4.0/servertests/st_read.py
> @@ -91,6 +91,18 @@ def testLargeOffset(t, env):
> check(res, msg="Reading file /%s" % b'/'.join(env.opts.usefile))
> _compare(t, res, b'', True)
>
> +def testVeryLargeOffset(t, env):
> + """READ with offset far outside file
> +
> + FLAGS: read all
> + DEPEND: LOOKFILE
> + CODE: RD5a
> + """
> + c = env.c1
> + res = c.read_file(env.opts.usefile, 0x7ffffffffffffffc, 10)
> + check(res, msg="Reading file /%s" % b'/'.join(env.opts.usefile))
> + _compare(t, res, b'', True)
> +
> def testZeroCount(t, env):
> """READ with count=0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-05 20:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-05 17:05 [PATCH] nfsv4.0/read: Test the behavior of reading near OFFSET_MAX Chuck Lever
2022-02-05 20:06 ` 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.