NFS: Relax requirements in nfs_flush_incompatible
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 1 Oct 2015 21:17:06 +0000 (17:17 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 31 Dec 2015 20:55:35 +0000 (15:55 -0500)
If two processes share the same credentials and NFSv4 open stateid, then
allow them both to dirty the same page, even if their nfs_open_context
differs.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/internal.h
fs/nfs/pagelist.c
fs/nfs/write.c

index 99a2919047e9b0e6ccad3d8867836db7cf3a2a4c..870e2ba7ba49e0169dc5306cdea365c760b674ba 100644 (file)
@@ -264,6 +264,12 @@ static inline bool nfs_pgio_has_mirroring(struct nfs_pageio_descriptor *desc)
        return desc->pg_mirror_count > 1;
 }
 
+static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
+               const struct nfs_open_context *ctx2)
+{
+       return ctx1->cred == ctx2->cred && ctx1->state == ctx2->state;
+}
+
 /* nfs2xdr.c */
 extern struct rpc_procinfo nfs_procedures[];
 extern int nfs2_decode_dirent(struct xdr_stream *,
index 452a011ba0d8a33e9e4b9afd858f82858185f57e..c3a78450a2395fa6423450cfd73651527ea45753 100644 (file)
@@ -903,12 +903,6 @@ static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio)
        pgio->pg_mirrors_dynamic = NULL;
 }
 
-static bool nfs_match_open_context(const struct nfs_open_context *ctx1,
-               const struct nfs_open_context *ctx2)
-{
-       return ctx1->cred == ctx2->cred && ctx1->state == ctx2->state;
-}
-
 static bool nfs_match_lock_context(const struct nfs_lock_context *l1,
                const struct nfs_lock_context *l2)
 {
index 0aa8d6f23b4cc44e7e71ea4546e59e24f2aa1d01..2c26e04d93968cf38e815af292a8b2ef5254f5ee 100644 (file)
@@ -1130,7 +1130,8 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
                if (req == NULL)
                        return 0;
                l_ctx = req->wb_lock_context;
-               do_flush = req->wb_page != page || req->wb_context != ctx;
+               do_flush = req->wb_page != page ||
+                       !nfs_match_open_context(req->wb_context, ctx);
                /* for now, flush if more than 1 request in page_group */
                do_flush |= req->wb_this_page != req;
                if (l_ctx && flctx &&