aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-06 19:10:59 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-08 12:53:21 -0400
commit14546c337588370dced50dcaf43398939be9829e (patch)
tree4eca561ff63c86ce9fcbd4dd2cc96cdf3989283e /fs/nfs/file.c
parent1385b8117325e79f74c1e7d1cbf45c789deb85c5 (diff)
NFS: Don't do a full flush to disk on close() if we hold a delegation
If we hold a delegation then we know that it should be safe to continue to cache the data beyond the close(). However since the process that wrote the data may die after close(), we may still want to send the data to server before those RPCSEC_GSS credentials expire. We therefore compromise by starting writeback to the server, but don't wait for completion. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index aa9b709fd328..8eda8a6644c3 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -174,6 +174,13 @@ nfs_file_flush(struct file *file, fl_owner_t id)
174 if ((file->f_mode & FMODE_WRITE) == 0) 174 if ((file->f_mode & FMODE_WRITE) == 0)
175 return 0; 175 return 0;
176 176
177 /*
178 * If we're holding a write delegation, then just start the i/o
179 * but don't wait for completion (or send a commit).
180 */
181 if (nfs_have_delegation(inode, FMODE_WRITE))
182 return filemap_fdatawrite(file->f_mapping);
183
177 /* Flush writes to the server and return any errors */ 184 /* Flush writes to the server and return any errors */
178 return vfs_fsync(file, 0); 185 return vfs_fsync(file, 0);
179} 186}