Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Nov 97 14:48:58 -0800
From:      "Mike Burgett" <mburgett@awen.com>
To:        "stable@freebsd.org" <stable@freebsd.org>
Subject:   nfs and mounting more than once...
Message-ID:  <199711222248.OAA00338@dragon.awen.com>

next in thread | raw e-mail | index | archive | help
The below patch is intended to prevent being able to remount nfs partitions 
over and over (and having to umount them over and over to really get rid of 
them...)  It was against the 2.2-stable version of nfs_vfsops.c currently in 
the tree:

-rw-r--r--  1 root  bin  27284 Oct 17 05:16 /usr/src/sys/nfs/nfs_vfsops.c

If anyone is feeling adventurous, I'd like to get feedback about any 
unintended side effects.  I run a simple system here, with no union mounts, 
diskless clients or any other stuff that this could break. :)

Thanks,
Mike


---- cut here ----
*** /usr/src/sys/nfs/nfs_vfsops.c	Fri Oct 17 05:16:43 1997
--- ./nfs_vfsops.c	Sat Nov 22 14:29:58 1997
***************
*** 574,579 ****
--- 574,580 ----
  	char pth[MNAMELEN], hst[MNAMELEN];
  	u_int len;
  	u_char nfh[NFSX_V3FHMAX];
+ 	int ncount;
  
  	error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args));
  	if (error)
***************
*** 589,594 ****
--- 590,601 ----
  	if (error)
  		return (error);
  	bzero(&hst[len], MNAMELEN - len);
+ 	/* checks stolen from ffs_vfsops.c to prevent duplicate mounts */
+ 	ncount = vcount(ndp->ni_vp);
+ 	if (ndp->ni_vp->v_object != NULL)
+ 		ncount -= 1;
+ 	if (ncount > 1 && ndp->ni_vp != rootvp)
+ 		return (EBUSY);
  	/* sockargs() call must be after above copyin() calls */
  	error = sockargs(&nam, (caddr_t)args.addr, args.addrlen, MT_SONAME);
  	if (error)
--- cut here ----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711222248.OAA00338>