All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] remove extraneous mountlist_add/del calls and change remaining ones to use IP addresses
@ 2006-12-18 20:43 Jeff Layton
  2006-12-18 22:47 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2006-12-18 20:43 UTC (permalink / raw)
  To: nfs; +Cc: neilb

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.

Neil, I'm open to respinning this so that it gets called again from the kernel
caching routines, but I'm not sure how to prevent the rmtab from growing w/o
bound that way.

Signed-off-by: Jeff Layton <jlayton@redhat.com>

--- nfs-utils-1.0.10/utils/mountd/cache.c.mlcleanup
+++ nfs-utils-1.0.10/utils/mountd/cache.c
@@ -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, stru
  	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);
  }

--- nfs-utils-1.0.10/utils/mountd/mountd.c.mlcleanup
+++ nfs-utils-1.0.10/utils/mountd/mountd.c
@@ -225,14 +225,11 @@ mount_umnt_1_svc(struct svc_req *rqstp,
  	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, dirpat
  		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, dirpat
  						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;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] remove extraneous mountlist_add/del calls and change remaining ones to use IP addresses
  2006-12-18 20:43 [PATCH 2/3] remove extraneous mountlist_add/del calls and change remaining ones to use IP addresses Jeff Layton
@ 2006-12-18 22:47 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2006-12-18 22:47 UTC (permalink / raw)
  To: Jeff Layton; +Cc: nfs


Thanks for these Jeff.  I've committed them to the nfs-utils git tree.

> 
> Neil, I'm open to respinning this so that it gets called again from the kernel
> caching routines, but I'm not sure how to prevent the rmtab from growing w/o
> bound that way.

The only way I can think of it by adding timestamp information to
rmtab, and ignoring entries older than some timeout.  The kernel
caches have a timeout and refresh regularly so active entries would be
kept up-to-date and inactive entries would appear old.  Any code that
updates rmtab could remove old entries so rmtab wouldn't grow too
much.

It might be worth while if people want to use showmount for NFSv4...

Thanks,
NeilBrown

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-18 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-18 20:43 [PATCH 2/3] remove extraneous mountlist_add/del calls and change remaining ones to use IP addresses Jeff Layton
2006-12-18 22:47 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.