]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Make warning about host matching multiple exports more helpful.
authorNeil Brown <neilb@suse.de>
Sun, 18 Mar 2007 23:22:22 +0000 (10:22 +1100)
committerNeil Brown <neilb@suse.de>
Sun, 18 Mar 2007 23:22:22 +0000 (10:22 +1100)
1/ only warn once per export, as it could get too noisy.
2/ make it a little clearer why this might be a problem.

support/export/export.c
support/include/exportfs.h
utils/exportfs/exportfs.c
utils/mountd/cache.c

index a4b0788e4f6977057be760769e1b680c9440cc64..74e1d1b1bc46c68ace868e87775eed3580e46372 100644 (file)
@@ -90,6 +90,7 @@ export_init(nfs_export *exp, nfs_client *clp, struct exportent *nep)
        exp->m_xtabent = 0;
        exp->m_mayexport = 0;
        exp->m_changed = 0;
+       exp->m_warned = 0;
        exp->m_client = clp;
        clp->m_count++;
 }
@@ -115,6 +116,7 @@ export_dup(nfs_export *exp, struct hostent *hp)
        new->m_exported = 0;
        new->m_xtabent = 0;
        new->m_changed = 0;
+       new->m_warned = 0;
        export_add(new);
 
        return new;
index 458611b8f5ac3d3b0056c056b08079bd0040b965..431b5ce7701c0036668d8a61b31367f7b654c44f 100644 (file)
@@ -47,7 +47,9 @@ typedef struct mexport {
        int                     m_exported;     /* known to knfsd. -1 means not sure */
        int                     m_xtabent  : 1, /* xtab entry exists */
                                m_mayexport: 1, /* derived from xtabbed */
-                               m_changed  : 1; /* options (may) have changed */
+                               m_changed  : 1, /* options (may) have changed */
+                               m_warned   : 1; /* warned about multiple exports
+                                                * matching one client */
 } nfs_export;
 
 extern nfs_client *            clientlist[MCL_MAXTYPES];
index 1eca5676e4b23d4445ccce0fef51184ae3816ea5..8c3f634de5984848de3ccc61037774ecbf89f791 100644 (file)
@@ -218,6 +218,7 @@ export_all(int verbose)
                        exp->m_xtabent = 1;
                        exp->m_mayexport = 1;
                        exp->m_changed = 1;
+                       exp->m_warned = 0;
                }
        }
 }
@@ -274,6 +275,7 @@ exportfs(char *arg, char *options, int verbose)
        exp->m_xtabent = 1;
        exp->m_mayexport = 1;
        exp->m_changed = 1;
+       exp->m_warned = 0;
        if (hp) free (hp);
 }
 
index ed7fe3534ad3e5ae4ffff535b434913f221812b8..5612a9edf547ed626f35d27d50ffc3e22aa88612 100644 (file)
@@ -520,10 +520,12 @@ void nfsd_export(FILE *f)
                        if (!found) {
                                found = exp;
                                found_type = i;
-                       } else if (found_type == i) {
-                               xlog(L_WARNING, "%s exported to both %s and %s in %s",
-                                    path, exp->m_client->m_hostname, found->m_client->m_hostname,
+                       } else if (found_type == i && found->m_warned == 0) {
+                               xlog(L_WARNING, "%s exported to both %s and %s, "
+                                    "arbitrarily choosing options from first",
+                                    path, found->m_client->m_hostname, exp->m_client->m_hostname,
                                     dom);
+                               found->m_warned = 1;
                        }
                }
        }