From 7b0e4faaf3169c69828d3f7769ed8ce9142e100b Mon Sep 17 00:00:00 2001 From: Ben Myers Date: Fri, 12 Feb 2010 14:02:21 -0500 Subject: nfs-utils: don't fdatasync the rmtab 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. Signed-off-by: Steve Dickson --- support/nfs/rmtab.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'support/nfs/rmtab.c') 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); } } -- cgit