Skip to contentSkip to conversation

mountd: remove bogus mountlist_add/del calls, track only v2/3 mounts

PATCH In review Jeff Layton 2 participants 4 messages Oct 25, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mountd: remove bogus mountlist_add/del calls, track only v2/3 mounts

This patch removes several mountlist_add and mountlist_del calls that seem to be unnecessary. In particular, it removes these calls in a couple of places that seem to be using it incorrectly (where it's calling mountlist_add with the path section set to the hostname). This patch gets rid of the lines in rmtab that look like this:

10.10.1.41:*
172.16.33.192:*
172.16.33.192:*,foo.bar.baz

Also, with this patch, NFSv4 mounts are no longer tracked in the rmtab. In nfs4, it doesn't seem like any calls to mountd are made when a filesystem is unmounted. Since we have no way to reliably track unmounts of nfs4 filesystems in mountd, I figured it was best to just have mountd not attempt to track mounts either.

utils/mountd/cache.c renamed from utils/mountd/cache.c.mladd +0 -8
@@ -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);
 	
 }
@@ -373,8 +370,6 @@ void cache_export_ent(char *domain, stru
 	qword_eol(f);
 
 	fclose(f);
-
-	mountlist_add(domain, exp->e_path);
 }
 
 void cache_export(nfs_export *exp)
@@ -393,9 +388,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);
 }
 
utils/mountd/mountd.c renamed from utils/mountd/mountd.c.mladd +9 -10
@@ -222,17 +222,13 @@ mount_umnt_1_svc(struct svc_req *rqstp, 
 		p = rpath;
 	}
 
-	if (!(exp = auth_authenticate("unmount", sin, p))) {
+	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);
+
+	mountlist_del(exp->m_client->m_hostname, p);
+	if (!new_cache)
 		export_reset (exp);
-	}
+
 	return 1;
 }
 
@@ -421,8 +417,11 @@ get_rootfh(struct svc_req *rqstp, dirpat
 		fh = cache_get_filehandle(exp, v3?64:32, p);
 		if (fh == NULL) 
 			*error = NFSERR_ACCES;
-		else
+		else {
 			*error = NFS_OK;
+			mountlist_add(exp->m_client->m_hostname,
+					exp->m_export.e_path);
+		}
 		return fh;
 	} else {
 		struct nfs_fh_len  *fh;

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 5 lines · Jeff Layton

Also, with this patch, NFSv4 mounts are no longer tracked in the rmtab. In nfs4, it doesn't seem like any calls to mountd are made when a filesystem is unmounted. Since we have no way to reliably track unmounts of nfs4 filesystems in mountd, I figured it was best to just have mountd not attempt to track mounts either.

An NFSv4 client will never talk to the mountd daemon at all. Not for mounting or for unmounting. It only talks to the NFS daemon, which will do an upcall to mountd in order to figure out what the export options are. That shouldn't result in an rmtab entry being created, though.

Cheers,
Trond

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
Quoted 7 lines · Trond Myklebust

An NFSv4 client will never talk to the mountd daemon at all. Not for mounting or for unmounting. It only talks to the NFS daemon, which will do an upcall to mountd in order to figure out what the export options are. That shouldn't result in an rmtab entry being created, though.

Cheers,
Trond

Right, sorry if I wasn't clear...

The problem there is in the upcall. It can result in cache_export_ent() getting called which will call mountlist_add() unconditionally. The patch corrects this by moving the mountlist_add() out of cache_export_ent() and into get_rootfh().

-- Jeff

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw
Quoted 9 lines · Jeff Layton
Quoted 7 lines · Trond Myklebust

An NFSv4 client will never talk to the mountd daemon at all. Not for mounting or for unmounting. It only talks to the NFS daemon, which will do an upcall to mountd in order to figure out what the export options are. That shouldn't result in an rmtab entry being created, though.

Cheers,
Trond

Quoted 6 lines

Right, sorry if I wasn't clear...

The problem there is in the upcall. It can result in cache_export_ent() getting called which will call mountlist_add() unconditionally. The patch corrects this by moving the mountlist_add() out of cache_export_ent() and into get_rootfh().

OK. That would appear to make sense. I wonder why it was moved into the upcall in the first place. Neil?

Cheers,
Trond

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs