summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOlga Kornievskaia <kolga@netapp.com>2021-03-31 15:30:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 10:40:31 +0200
commit4fc6ebddfffa50d9b4bd9915d303c62f2939208c (patch)
treef69b691312f7e2f4660217219e8eb9f6c7ed2ad6 /fs
parentc621f3654bba1096ec913d0942e27bd032bb6090 (diff)
downloadlinux-stable-4fc6ebddfffa50d9b4bd9915d303c62f2939208c.tar.gz
linux-stable-4fc6ebddfffa50d9b4bd9915d303c62f2939208c.tar.bz2
linux-stable-4fc6ebddfffa50d9b4bd9915d303c62f2939208c.zip
NFSv4.2 fix handling of sr_eof in SEEK's reply
[ Upstream commit 73f5c88f521a630ea1628beb9c2d48a2e777a419 ] 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@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs42proc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 7e9fb1119bcf..7efb9e0e9f25 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -294,7 +294,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)