summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-09-05 19:06:58 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-09-07 12:36:17 -0400
commit5445b1fbd123420bffed5e629a420aa2a16bf849 (patch)
treedaea751ed98d60c445017472d6f2545452e0224a /fs/nfs/file.c
parent7d160a6c462c2c690e074c173b43aad7204049ad (diff)
NFSv4: Respect the server imposed limit on how many changes we may cache
The NFSv4 delegation spec allows the server to tell a client to limit how much data it cache after the file is closed. In return, the server guarantees enough free space to avoid ENOSPC situations, etc. Prior to this patch, we assumed we could always cache aggressively after close. Unfortunately, this causes problems with servers that set the limit to 0 and therefore do not offer any ENOSPC guarantees. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 526a2681d975..c0f9b1ed12b9 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(nfs_file_llseek);
142/* 142/*
143 * Flush all dirty pages, and check for write errors. 143 * Flush all dirty pages, and check for write errors.
144 */ 144 */
145int 145static int
146nfs_file_flush(struct file *file, fl_owner_t id) 146nfs_file_flush(struct file *file, fl_owner_t id)
147{ 147{
148 struct inode *inode = file_inode(file); 148 struct inode *inode = file_inode(file);
@@ -153,17 +153,9 @@ nfs_file_flush(struct file *file, fl_owner_t id)
153 if ((file->f_mode & FMODE_WRITE) == 0) 153 if ((file->f_mode & FMODE_WRITE) == 0)
154 return 0; 154 return 0;
155 155
156 /*
157 * If we're holding a write delegation, then just start the i/o
158 * but don't wait for completion (or send a commit).
159 */
160 if (NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE))
161 return filemap_fdatawrite(file->f_mapping);
162
163 /* Flush writes to the server and return any errors */ 156 /* Flush writes to the server and return any errors */
164 return vfs_fsync(file, 0); 157 return vfs_fsync(file, 0);
165} 158}
166EXPORT_SYMBOL_GPL(nfs_file_flush);
167 159
168ssize_t 160ssize_t
169nfs_file_read(struct kiocb *iocb, struct iov_iter *to) 161nfs_file_read(struct kiocb *iocb, struct iov_iter *to)