diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2022-05-14 10:27:01 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2022-05-17 12:01:59 -0400 |
commit | 9641d9bc9b75f11f70646f5c6ee9f5f519a1012e (patch) | |
tree | dcec41d4199dad29c034eb83619787d8800d0496 /fs/nfs/file.c | |
parent | cea9ba7239dcc84175041174304c6cdeae3226e5 (diff) | |
download | lwn-9641d9bc9b75f11f70646f5c6ee9f5f519a1012e.tar.gz lwn-9641d9bc9b75f11f70646f5c6ee9f5f519a1012e.zip |
NFS: fsync() should report filesystem errors over EINTR/ERESTARTSYS
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: 2197e9b06c22 ("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>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 150b7fa8f0a7..7c380e555224 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -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 |