diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-11 16:19:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:05 -0400 |
commit | dcfc4f25461813e8a2dd43b052aa1e0be155742f (patch) | |
tree | 82edc73de99f2ce16fa9072964337699158abd34 /fs/nfs | |
parent | 05990d1bf2708b9e84d67074551f964d3738eedc (diff) |
NFS: Write the entire file if a server reboot occurs during fsync()
This is to ensure that we don't clear the NFS_CONTEXT_RESEND_WRITES
flag while there are still writes that haven't been resent.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/file.c | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4file.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index cc9b56691bef..c814666bbe7f 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -301,6 +301,13 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
301 | mutex_lock(&inode->i_mutex); | 301 | mutex_lock(&inode->i_mutex); |
302 | ret = nfs_file_fsync_commit(file, start, end, datasync); | 302 | ret = nfs_file_fsync_commit(file, start, end, datasync); |
303 | mutex_unlock(&inode->i_mutex); | 303 | mutex_unlock(&inode->i_mutex); |
304 | /* | ||
305 | * If nfs_file_fsync_commit detected a server reboot, then | ||
306 | * resend all dirty pages that might have been covered by | ||
307 | * the NFS_CONTEXT_RESEND_WRITES flag | ||
308 | */ | ||
309 | start = 0; | ||
310 | end = LLONG_MAX; | ||
304 | } while (ret == -EAGAIN); | 311 | } while (ret == -EAGAIN); |
305 | 312 | ||
306 | return ret; | 313 | return ret; |
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index eef1b38a1b08..afddd6639afb 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -105,6 +105,13 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
105 | /* application has asked for meta-data sync */ | 105 | /* application has asked for meta-data sync */ |
106 | ret = pnfs_layoutcommit_inode(inode, true); | 106 | ret = pnfs_layoutcommit_inode(inode, true); |
107 | mutex_unlock(&inode->i_mutex); | 107 | mutex_unlock(&inode->i_mutex); |
108 | /* | ||
109 | * If nfs_file_fsync_commit detected a server reboot, then | ||
110 | * resend all dirty pages that might have been covered by | ||
111 | * the NFS_CONTEXT_RESEND_WRITES flag | ||
112 | */ | ||
113 | start = 0; | ||
114 | end = LLONG_MAX; | ||
108 | } while (ret == -EAGAIN); | 115 | } while (ret == -EAGAIN); |
109 | 116 | ||
110 | return ret; | 117 | return ret; |