--- fs/nfs/filelayout/filelayout.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index d39a1f58e18d..1cb8f413a665 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c @@ -48,6 +48,8 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Dean Hildebrand <dhildebz@xxxxxxxxx>"); MODULE_DESCRIPTION("The NFSv4 file layout driver"); +static bool force_layoutcommit = false; + #define FILELAYOUT_POLL_RETRY_MAX (15*HZ) static const struct pnfs_commit_ops filelayout_commit_ops; @@ -233,10 +235,11 @@ filelayout_set_layoutcommit(struct nfs_pgio_header *hdr) { loff_t end_offs = 0; - if (FILELAYOUT_LSEG(hdr->lseg)->commit_through_mds || - hdr->res.verf->committed == NFS_FILE_SYNC) + if (!force_layoutcommit && (FILELAYOUT_LSEG(hdr->lseg)->commit_through_mds || + hdr->res.verf->committed == NFS_FILE_SYNC)) return; - if (hdr->res.verf->committed == NFS_DATA_SYNC) + if (hdr->res.verf->committed == NFS_DATA_SYNC || + (force_layoutcommit && hdr->res.verf->committed == NFS_FILE_SYNC)) end_offs = hdr->mds_offset + (loff_t)hdr->res.count; /* Note: if the write is unstable, don't set end_offs until commit */ @@ -1149,5 +1152,8 @@ static void __exit nfs4filelayout_exit(void) MODULE_ALIAS("nfs-layouttype4-1"); +module_param(force_layoutcommit, bool, 0644); +MODULE_PARM_DESC(force_layoutcommit, "Force LAYOUTCOMMIT after data was written (default: false)"); + module_init(nfs4filelayout_init); module_exit(nfs4filelayout_exit); -- 2.51.0.87.g1fa68948c3.dirty