aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorGravatar Trond Myklebust <trond.myklebust@primarydata.com> 2016-06-26 18:54:58 -0400
committerGravatar Trond Myklebust <trond.myklebust@primarydata.com> 2016-07-05 19:08:01 -0400
commit2e18d4d822ea9cc811ea26a880cf2ed47cbf8889 (patch)
tree1ce746bef1598990b96f6f5b4e0c11017a3c9ee7 /fs/nfs/pnfs.c
parentpNFS/flexfiles: Clean up calls to pnfs_set_layoutcommit() (diff)
downloadlinux-2e18d4d822ea9cc811ea26a880cf2ed47cbf8889.tar.gz
linux-2e18d4d822ea9cc811ea26a880cf2ed47cbf8889.tar.bz2
linux-2e18d4d822ea9cc811ea26a880cf2ed47cbf8889.zip
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/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 0c7e0d45a4de..62553182514e 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2378,7 +2378,10 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
nfs_fattr_init(&data->fattr);
data->args.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask;
data->res.fattr = &data->fattr;
- data->args.lastbytewritten = end_pos - 1;
+ if (end_pos != 0)
+ data->args.lastbytewritten = end_pos - 1;
+ else
+ data->args.lastbytewritten = U64_MAX;
data->res.server = NFS_SERVER(inode);
if (ld->prepare_layoutcommit) {