From: Ben Myers <bpm@sgi.com>
To: SteveD@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 3/3] nfs-utils: don't fdatasync the rmtab
Date: Thu, 28 Jan 2010 15:26:39 -0600 [thread overview]
Message-ID: <20100128212639.29681.81589.stgit@case.americas.sgi.com> (raw)
In-Reply-To: <20100128211454.29681.24752.stgit-PhfrMOq4MEUPybYDWDrblq0bRtRcJeJQ@public.gmane.org>
If we're using the new caching interface the rmtab will be ignored by exportfs
so there is no need to fdatasync. This improves mountd performance.
---
support/nfs/cacheio.c | 5 ++---
support/nfs/rmtab.c | 23 ++++++++++++++++++-----
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
index 6a6ed5a..bdf5d84 100644
--- a/support/nfs/cacheio.c
+++ b/support/nfs/cacheio.c
@@ -285,9 +285,8 @@ int readline(int fd, char **buf, int *lenp)
int
check_new_cache(void)
{
- struct stat stb;
- return (stat("/proc/fs/nfs/filehandle", &stb) == 0) ||
- (stat("/proc/fs/nfsd/filehandle", &stb) == 0);
+ return (access("/proc/fs/nfs/filehandle", F_OK) == 0) ||
+ (access("/proc/fs/nfsd/filehandle", F_OK) == 0);
}
diff --git a/support/nfs/rmtab.c b/support/nfs/rmtab.c
index 4cbd285..a28abf3 100644
--- a/support/nfs/rmtab.c
+++ b/support/nfs/rmtab.c
@@ -117,11 +117,24 @@ void
fendrmtabent(FILE *fp)
{
if (fp) {
- /* If it was written to, we really want
- * to flush to disk before returning
- */
- fflush(fp);
- fdatasync(fileno(fp));
+ static int have_new_cache = -1;
+ if (have_new_cache == -1) /* check only once */
+ have_new_cache = check_new_cache();
+
+ if (!have_new_cache) {
+ /*
+ * If we are using the old caching interface: exportfs
+ * uses the rmtab to determine what should be exported,
+ * so it is important that it be up-to-date.
+ *
+ * If we are using the new caching interface: the rmtab
+ * is ignored by exportfs and the fdatasync only serves
+ * to slow us down.
+ */
+ fflush(fp);
+ fdatasync(fileno(fp));
+ }
+
fclose(fp);
}
}
next prev parent reply other threads:[~2010-01-28 21:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-28 21:26 [PATCH 0/3] nfs-utils: multithreaded mountd fixes Ben Myers
[not found] ` <20100128211454.29681.24752.stgit-PhfrMOq4MEUPybYDWDrblq0bRtRcJeJQ@public.gmane.org>
2010-01-28 21:26 ` [PATCH 1/3] nfs-utils: remove xflock timeout Ben Myers
2010-01-28 21:26 ` [PATCH 2/3] nfs-utils: dont leak fd in mountlist_list Ben Myers
2010-01-28 21:26 ` Ben Myers [this message]
2010-02-12 19:03 ` [PATCH 0/3] nfs-utils: multithreaded mountd fixes Steve Dickson
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=20100128212639.29681.81589.stgit@case.americas.sgi.com \
--to=bpm@sgi.com \
--cc=SteveD@redhat.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