Skip to content

Commit

Permalink
NFSv4.2: handle NFS-specific llseek errors
Browse files Browse the repository at this point in the history
Handle NFS-specific llseek errors instead of letting them leak out to
userspace.

Reported-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
J. Bruce Fields authored and trondmypd committed Jul 27, 2015
1 parent d4c3045 commit bdcc2cd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion fs/nfs/nfs42proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len)
return err;
}

loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
static loff_t _nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
{
struct inode *inode = file_inode(filep);
struct nfs42_seek_args args = {
Expand Down Expand Up @@ -171,6 +171,23 @@ loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
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)
{
struct nfs_server *server = NFS_SERVER(file_inode(filep));
struct nfs4_exception exception = { };
int err;

do {
err = _nfs42_proc_llseek(filep, offset, whence);
if (err == -ENOTSUPP)
return -EOPNOTSUPP;
err = nfs4_handle_exception(server, err, &exception);
} while (exception.retry);

return err;
}


static void
nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
{
Expand Down

0 comments on commit bdcc2cd

Please sign in to comment.