Skip to content

Commit

Permalink
NFS: fsync() should report filesystem errors over EINTR/ERESTARTSYS
Browse files Browse the repository at this point in the history
If the commit to disk is interrupted, we should still first check for
filesystem errors so that we can report them in preference to the error
due to the signal.

Fixes: 2197e9b ("NFS: Fix up fsync() when the server rebooted")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
Trond Myklebust authored and Anna Schumaker committed May 17, 2022
1 parent cea9ba7 commit 9641d9b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,16 @@ static int
nfs_file_fsync_commit(struct file *file, int datasync)
{
struct inode *inode = file_inode(file);
int ret;
int ret, ret2;

dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync);

nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
ret = nfs_commit_inode(inode, FLUSH_SYNC);
if (ret < 0)
return ret;
return file_check_and_advance_wb_err(file);
ret2 = file_check_and_advance_wb_err(file);
if (ret2 < 0)
return ret2;
return ret;
}

int
Expand Down

0 comments on commit 9641d9b

Please sign in to comment.