* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <sys/fcntl.h>
#include <stdlib.h>
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);
}
}