Re: [PATCH 1/1] NFSv4.2 fix handling of sr_eof in SEEK's reply

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

 



On Wed, 2021-03-31 at 15:30 -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@xxxxxxxxxx>
> 
> Currently the client ignores the value of the sr_eof of the SEEK
> operation. According to the spec, if the server didn't find the
> requested extent and reached the end of the file, the server
> would return sr_eof=true. In case the request for DATA and no
> data was found (ie in the middle of the hole), then the lseek
> expects that ENXIO would be returned.
> 
> Fixes: 1c6dcbe5ceff8 ("NFS: Implement SEEK")
> Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx>
> ---
>  fs/nfs/nfs42proc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index 094024b0aca1..d359e712c11d 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -659,7 +659,10 @@ static loff_t _nfs42_proc_llseek(struct file
> *filep,
>         if (status)
>                 return status;
>  
> -       return vfs_setpos(filep, res.sr_offset, inode->i_sb-
> >s_maxbytes);
> +       if (whence == SEEK_DATA && res.sr_eof)
> +               return -NFS4ERR_NXIO;
> +       else
> +               return vfs_setpos(filep, res.sr_offset, inode->i_sb-
> >s_maxbytes);
>  }
>  
>  loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int
> whence)

Don't we also need to deal with SEEK_HOLE with the offset being greater
than the end-of-file in the same way?

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx






[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