Re: [PATCH] nfsv4.0/read: Test the behavior of reading near OFFSET_MAX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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
>  
> 



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux