]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
See Changelog
authorneilbrown <neilbrown>
Thu, 17 Jan 2002 00:03:48 +0000 (00:03 +0000)
committerneilbrown <neilbrown>
Thu, 17 Jan 2002 00:03:48 +0000 (00:03 +0000)
ChangeLog
support/nfs/exports.c
utils/exportfs/exports.man

index 59276ddc2eadd396190625d29536ad3c8f564758..93d5ab8ca9824b9f10665b414cc2c78f06d62ce6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-01-17   Adrian Drzewiecki <drze@MissionCriticalLinux.com>
+            NeilBrown <neilb@cse.unsw.edu.au>
+
+       * support/nfs/exports.c: remove NFSEXP_ASYNC as a default
+       flag so that "sync" becomes the default.
+       Check that either "sync" or "async" is given as an option
+       and warn if neither are present
+       * utils/exportfs/exports.man: change documentation for "sync"
+       to be documentation for "async".
+       * utils/exportfs/exportfs.man: note that "sync" is the default
+       rather than "async"
+       
+       
 2002-01-02  Chip Salzenberg  <chip@pobox.com>
 
        * support/export/nfsctl.c (expsetup): Don't export entries that
 2002-01-02  Chip Salzenberg  <chip@pobox.com>
 
        * support/export/nfsctl.c (expsetup): Don't export entries that
index 7e0decf0b4d12cb77b868aff7eb4f7b7a48f2f15..0dce25ff9291dd28d0c4b608c50fe1cc289f9d62 100644 (file)
@@ -29,7 +29,7 @@
 #include "xio.h"
 
 #define EXPORT_DEFAULT_FLAGS   \
 #include "xio.h"
 
 #define EXPORT_DEFAULT_FLAGS   \
-  (NFSEXP_ASYNC|NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES)
+  (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES)
 
 static char    *efname = NULL;
 static XFILE   *efp = NULL;
 
 static char    *efname = NULL;
 static XFILE   *efp = NULL;
@@ -117,10 +117,8 @@ getexportent(int fromkernel)
                        return NULL;
                }
                *sp = '\0';
                        return NULL;
                }
                *sp = '\0';
-               if (parseopts(opt, &ee) < 0)
-                       return NULL;
        } else {
        } else {
-           xlog(L_WARNING, "No options for %s %s: suggest %s() to avoid warning", ee.e_path, exp, exp);
+           xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp);
        }
        if (strlen(exp) >= sizeof(ee.e_hostname)) {
                syntaxerr("client name too long");
        }
        if (strlen(exp) >= sizeof(ee.e_hostname)) {
                syntaxerr("client name too long");
@@ -129,6 +127,9 @@ getexportent(int fromkernel)
        strncpy(ee.e_hostname, exp, sizeof (ee.e_hostname) - 1);
        ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
 
        strncpy(ee.e_hostname, exp, sizeof (ee.e_hostname) - 1);
        ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
 
+       if (parseopts(opt, &ee) < 0)
+               return NULL;
+
        /* resolve symlinks */
        if (realpath(ee.e_path, rpath) != NULL) {
                rpath[sizeof (rpath) - 1] = '\0';
        /* resolve symlinks */
        if (realpath(ee.e_path, rpath) != NULL) {
                rpath[sizeof (rpath) - 1] = '\0';
@@ -266,7 +267,7 @@ mkexportent(char *hname, char *path, char *options)
        ee.e_path[sizeof (ee.e_path) - 1] = '\0';
        strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1);
        ee.m_path [sizeof (ee.m_path) - 1] = '\0';
        ee.e_path[sizeof (ee.e_path) - 1] = '\0';
        strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1);
        ee.m_path [sizeof (ee.m_path) - 1] = '\0';
-       if (options && parseopts(options, &ee) < 0)
+       if (parseopts(options, &ee) < 0)
                return NULL;
        return &ee;
 }
                return NULL;
        return &ee;
 }
@@ -274,7 +275,7 @@ mkexportent(char *hname, char *path, char *options)
 int
 updateexportent(struct exportent *eep, char *options)
 {
 int
 updateexportent(struct exportent *eep, char *options)
 {
-       if (options && parseopts(options, eep) < 0)
+       if (parseopts(options, eep) < 0)
                return 0;
        return 1;
 }
                return 0;
        return 1;
 }
@@ -285,12 +286,17 @@ updateexportent(struct exportent *eep, char *options)
 static int
 parseopts(char *cp, struct exportent *ep)
 {
 static int
 parseopts(char *cp, struct exportent *ep)
 {
+       int     had_sync_opt = 0;
 
        squids = ep->e_squids; nsquids = ep->e_nsquids;
        sqgids = ep->e_sqgids; nsqgids = ep->e_nsqgids;
 
 
        squids = ep->e_squids; nsquids = ep->e_nsquids;
        sqgids = ep->e_sqgids; nsqgids = ep->e_nsqgids;
 
+       if (!cp)
+               goto out;
+
        while (isblank(*cp))
                cp++;
        while (isblank(*cp))
                cp++;
+
        while (*cp) {
                char *opt = strdup(cp);
                char *optstart = cp;
        while (*cp) {
                char *opt = strdup(cp);
                char *optstart = cp;
@@ -310,11 +316,13 @@ parseopts(char *cp, struct exportent *ep)
                        ep->e_flags &= ~NFSEXP_INSECURE_PORT;
                else if (!strcmp(opt, "insecure"))
                        ep->e_flags |= NFSEXP_INSECURE_PORT;
                        ep->e_flags &= ~NFSEXP_INSECURE_PORT;
                else if (!strcmp(opt, "insecure"))
                        ep->e_flags |= NFSEXP_INSECURE_PORT;
-               else if (!strcmp(opt, "sync"))
+               else if (!strcmp(opt, "sync")) {
+                       had_sync_opt = 1;
                        ep->e_flags &= ~NFSEXP_ASYNC;
                        ep->e_flags &= ~NFSEXP_ASYNC;
-               else if (!strcmp(opt, "async"))
+               } else if (!strcmp(opt, "async")) {
+                       had_sync_opt = 1;
                        ep->e_flags |= NFSEXP_ASYNC;
                        ep->e_flags |= NFSEXP_ASYNC;
-               else if (!strcmp(opt, "nohide"))
+               else if (!strcmp(opt, "nohide"))
                        ep->e_flags |= NFSEXP_CROSSMNT;
                else if (!strcmp(opt, "hide"))
                        ep->e_flags &= ~NFSEXP_CROSSMNT;
                        ep->e_flags |= NFSEXP_CROSSMNT;
                else if (!strcmp(opt, "hide"))
                        ep->e_flags &= ~NFSEXP_CROSSMNT;
@@ -383,6 +391,13 @@ parseopts(char *cp, struct exportent *ep)
        ep->e_nsquids = nsquids;
        ep->e_nsqgids = nsqgids;
 
        ep->e_nsquids = nsquids;
        ep->e_nsqgids = nsqgids;
 
+out:
+       if (!had_sync_opt)
+               xlog(L_WARNING, "No 'sync' or 'async' option specified for export \"%s:%s\".\n"
+                               "  Assuming default behaviour ('sync').\n"
+                               "  NOTE: this default has changed from previous versions\n",
+                               ep->e_hostname, ep->e_path);
+
        return 1;
 }
 
        return 1;
 }
 
index 5dcc809361d6002df79eb3f76b0f43392116b832..97264cdc6511880f69ed3d00a0c092043b1abffd 100644 (file)
@@ -95,17 +95,31 @@ This can also be made explicit by using
 the
 .IR ro " option.
 .TP
 the
 .IR ro " option.
 .TP
-.IR sync
-This option requests that all file writes be committed to disc before
-the write request completes.  This is required for complete safety of
-data in the face of a server crash, but incurs a performance hit.
-The default is to allow the server to write the data out whenever it
-is ready.  This can be explicitly requested with the
-.IR async " option.
+.IR async
+This option allows the NFS server to violate the NFS protocol and
+reply to requests before any changes made by that request have been
+committed to stable storage (e.g. disc drive).
+
+Using this option usually improves performance, but at the cost that
+an unclean server restart (i.e. a crash) can cause data to be lost or
+corrupted.
+
+In releases of nfs-utils upto and including 1.0.0, this option was the
+default.  In this and future releases,
+.I sync
+is the default, and
+.I async
+must be explicit requested if needed.
+To help make system adminstrators aware of this change, 'exportfs'
+will issue a warning if neither
+.I sync
+nor
+.I async
+is specified.
 .TP
 .IR no_wdelay
 .TP
 .IR no_wdelay
-This option only has effect if
-.I sync
+This option has no effect if
+.I async
 is also set.  The NFS server will normally delay committing a write request
 to disc slightly if it suspects that another related write request may be in
 progress or may arrive soon.  This allows multiple write requests to
 is also set.  The NFS server will normally delay committing a write request
 to disc slightly if it suspects that another related write request may be in
 progress or may arrive soon.  This allows multiple write requests to