]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/exportfs/exportfs.c
Fix cache flushing problem.
[nfs-utils.git] / utils / exportfs / exportfs.c
index ab8a4a23bec6618283b3cfbbdca4181199c71df4..b4f0226042b22048725945755f0c04d99ef11757 100644 (file)
@@ -91,14 +91,23 @@ main(int argc, char **argv)
                fprintf(stderr, "exportfs: -r and -u are incompatible.\n");
                return 1;
        }
+       new_cache = check_new_cache();
        if (optind == argc && ! f_all) {
-               xtab_export_read();
-               dump(f_verbose);
-               return 0;
+               if (force_flush) {
+                       if (new_cache)
+                               cache_flush(1);
+                       else {
+                               fprintf(stderr, "exportfs: -f: only available with new cache controls: mount /proc/fs/nfsd first\n");
+                               exit(1);
+                       }
+                       return 0;
+               } else {
+                       xtab_export_read();
+                       dump(f_verbose);
+                       return 0;
+               }
        }
 
-       new_cache = check_new_cache();
-
        if (f_export && ! f_ignore)
                export_read(_PATH_EXPORTS);
        if (f_export) {
@@ -121,7 +130,8 @@ main(int argc, char **argv)
                if (!f_export)
                        for (i = optind ; i < argc ; i++)
                                unexportfs(argv[i], f_verbose);
-               rmtab_read();
+               if (!new_cache)
+                       rmtab_read();
        }
        if (!new_cache) {
                xtab_mount_read();
@@ -364,7 +374,7 @@ dump(int verbose)
                                c = dumpopt(c, "wdelay");
                        if (ep->e_flags & NFSEXP_NOHIDE)
                                c = dumpopt(c, "nohide");
-                       if (ep->e_flags & NFSEXP_CROSSMNT)
+                       if (ep->e_flags & NFSEXP_CROSSMOUNT)
                                c = dumpopt(c, "crossmnt");
                        if (ep->e_flags & NFSEXP_INSECURE_PORT)
                                c = dumpopt(c, "insecure");