Linux NFS development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: [PATCH/RFC] make nfs_flush_incompatible more forgiving.
Date: Wed, 4 Sep 2013 11:36:32 +1000	[thread overview]
Message-ID: <20130904113632.1a1eb337@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 2631 bytes --]


Hi,
 we have a customer who has noticed a significant regression in NFS
 performance between SLES10 (2.6.16+) and SLES11 (3.0+).

 The use case involves two different processes on the same client mmapping a
 file and making changes.

 In 2.6.16, all these changes would be cached on the client until a flush or
 close or other normal process flushed the changes out - much the same as if
 just one process was accessing the file.

 In 3.0 the file is flushed out every time a different process performs an
 update. So if they interleave accesses, you get a flush-to-the-server on
 every access.

 This is caused by nfs_flush_incompatible.  It deems access through different
 file descriptors to be incompatible.  However I don't think this is
 justified.  Accessed using different credentials can reasonably be seen as
 incompatible(*), but if two processes with identical credentials open the
 same file there there should be not need to differentiate between them.

 The patch below changes the test in nfs_flush_incompatible to just test the
 credentials (and the dentry, though that might be superfluous - it seems
 safer).

(*) In this specific customer's case the process do currently have slightly
 different credentials.  In one, the primary gid is included in the list of
 auxiliary gids.  In the other the primary gid is excluded.  This is enough
 to make the credentials appear different so this patch doesn't help in that
 case.  They are looking at being more consistent in their setgroups usage
 but it would help them if we only actually compared the credentials that
 were important.  In this case there is no important difference.
 Would it make sense to treat a more broad credential as compatible with a
 more narrow credential?  So a write from a process with a given
 uid,gid,grouplist could ultimately be sent to the server with same uid/gid,
 but a subset of the group list?
 

 Thoughts?

Thanks,
NeilBrown


diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 7816801..b0d4e47 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -860,7 +860,12 @@ 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;
+		if (req->wb_context != ctx) {
+			do_flush |=
+				req->wb_context->dentry != ctx->dentry ||
+				req->wb_context->cred != ctx->cred;
+		}
 		if (l_ctx) {
 			do_flush |= l_ctx->lockowner.l_owner != current->files
 				|| l_ctx->lockowner.l_pid != current->tgid;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

             reply	other threads:[~2013-09-04  1:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  1:36 NeilBrown [this message]
2013-09-04 14:33 ` [PATCH/RFC] make nfs_flush_incompatible more forgiving Myklebust, Trond
2013-09-04 23:29   ` NeilBrown
2013-09-05  3:17     ` Myklebust, Trond
2013-09-10  4:42       ` NeilBrown
2013-09-10 14:02         ` Myklebust, Trond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130904113632.1a1eb337@notabene.brown \
    --to=neilb@suse.de \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox