X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Frmtab.c;h=a28abf343898791b415336d36ef67c4977063d5f;hp=4cbd28591270a184b68e7ecedddc4828080814bb;hb=5f722d8855ebcb2d041e182c8c69c8cbee4bf408;hpb=ac5b03be829b4c9369ebfb07a688308721103228 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); } }