]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
remove extraneous mountlist_add/del calls and change remaining ones to use IP addresses
authorJeff Layton <jlayton@redhat.com>
Mon, 18 Dec 2006 20:43:56 +0000 (15:43 -0500)
committerNeil Brown <neilb@suse.de>
Mon, 18 Dec 2006 22:27:09 +0000 (09:27 +1100)
Neil suggested a patch to change the mountlist_add and mountlist_del calls to
use IP addresses instead of the names returned by client_compose based on a
command line option flag.

I don't see any real reason to put client_compose strings into the rmtab, so
this patch makes it so that it adds IP addresses instead of those strings to
the rmtab by default.

It also removes all mountlist_add calls that are being done from kernel cache
routines. My main concern there is NFSv4. We don't seem to make any upcalls to
mountd on NFSv4 unmounts, and I don't see a way to reliably remove NFSv4
entries. So, I figured I'd stick with having mountlist_add only called when
a v2 or v3 mount call is made, and mountlist_del called only on the
corresponding unmount call.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mountd/cache.c
utils/mountd/mountd.c

index c57d3b0a326a16adf01c4ee9b083f01df470fab3..726b98fc9b2a35681e7a4c07d2c2412b068ca33b 100644 (file)
@@ -83,9 +83,6 @@ void auth_unix_ip(FILE *f)
                qword_print(f, *client?client:"DEFAULT");
        qword_eol(f);
 
-       if (client && strcmp(ipaddr, client))
-               mountlist_add(ipaddr, *client?client:"DEFAULT");
-
        if (client) free(client);
        
 }
@@ -295,7 +292,6 @@ void nfsd_export(FILE *f)
                qword_printint(f, found->m_export.e_anonuid);
                qword_printint(f, found->m_export.e_anongid);
                qword_printint(f, found->m_export.e_fsid);
-               mountlist_add(dom, path);
        }
        qword_eol(f);
  out:
@@ -373,8 +369,6 @@ void cache_export_ent(char *domain, struct exportent *exp)
        qword_eol(f);
 
        fclose(f);
-
-       mountlist_add(domain, exp->e_path);
 }
 
 void cache_export(nfs_export *exp)
@@ -393,9 +387,6 @@ void cache_export(nfs_export *exp)
        
        fclose(f);
 
-       if (strcmp(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname))
-               mountlist_add(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname);
-
        cache_export_ent(exp->m_client->m_hostname, &exp->m_export);
 }
 
index f40d3673792e39551d331c32ece94873118a531a..e151fa2246eee9c390a0aee88996be0a3b85b808 100644 (file)
@@ -225,14 +225,11 @@ mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *resp)
        if (!(exp = auth_authenticate("unmount", sin, p))) {
                return 1;
        }
-       if (new_cache) {
-               if (strcmp(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname))
-                       mountlist_del(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname);
-               mountlist_del(exp->m_client->m_hostname, p);
-       } else {
-               mountlist_del(exp->m_client->m_hostname, p);
+
+       if (!new_cache)
                export_reset (exp);
-       }
+
+       mountlist_del(inet_ntoa(sin->sin_addr), p);
        return 1;
 }
 
@@ -421,8 +418,10 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, mountstat3 *error, int v3)
                fh = cache_get_filehandle(exp, v3?64:32, p);
                if (fh == NULL) 
                        *error = NFSERR_ACCES;
-               else
+               else {
                        *error = NFS_OK;
+                       mountlist_add(inet_ntoa(sin->sin_addr), p);
+               }
                return fh;
        } else {
                struct nfs_fh_len  *fh;
@@ -443,7 +442,7 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, mountstat3 *error, int v3)
                                                stb.st_dev, stb.st_ino);
                }
                if (fh != NULL) {
-                       mountlist_add(exp->m_client->m_hostname, p);
+                       mountlist_add(inet_ntoa(sin->sin_addr), p);
                        *error = NFS_OK;
                        export_reset (exp);
                        return fh;