aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/filelayout/filelayout.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-06-26 18:54:58 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-07-05 19:08:01 -0400
commit2e18d4d822ea9cc811ea26a880cf2ed47cbf8889 (patch)
tree1ce746bef1598990b96f6f5b4e0c11017a3c9ee7 /fs/nfs/filelayout/filelayout.c
parentbc28e1c2e3c8a4c5198ebfd8bbae0afd73dfafd5 (diff)
pNFS: Files and flexfiles always need to commit before layoutcommit
So ensure that we mark the layout for commit once the write is done, and then ensure that the commit to ds is finished before sending layoutcommit. Note that by doing this, we're able to optimise away the commit for the case of servers that don't need layoutcommit in order to return updated attributes. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/filelayout/filelayout.c')
-rw-r--r--fs/nfs/filelayout/filelayout.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index b4c1407e8fe4..25bd91a6e088 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -255,13 +255,16 @@ static int filelayout_read_done_cb(struct rpc_task *task,
255static void 255static void
256filelayout_set_layoutcommit(struct nfs_pgio_header *hdr) 256filelayout_set_layoutcommit(struct nfs_pgio_header *hdr)
257{ 257{
258 loff_t end_offs = 0;
258 259
259 if (FILELAYOUT_LSEG(hdr->lseg)->commit_through_mds || 260 if (FILELAYOUT_LSEG(hdr->lseg)->commit_through_mds ||
260 hdr->res.verf->committed != NFS_DATA_SYNC) 261 hdr->res.verf->committed == NFS_FILE_SYNC)
261 return; 262 return;
263 if (hdr->res.verf->committed == NFS_DATA_SYNC)
264 end_offs = hdr->mds_offset + (loff_t)hdr->res.count;
262 265
263 pnfs_set_layoutcommit(hdr->inode, hdr->lseg, 266 /* Note: if the write is unstable, don't set end_offs until commit */
264 hdr->mds_offset + hdr->res.count); 267 pnfs_set_layoutcommit(hdr->inode, hdr->lseg, end_offs);
265 dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino, 268 dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino,
266 (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); 269 (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb);
267} 270}