Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Nov 97 14:53:34 -0800
From:      "Mike Burgett" <mburgett@awen.com>
To:        "current@freebsd.org" <current@freebsd.org>
Subject:   nfs mounting the same partition over and over...
Message-ID:  <199711222253.OAA00371@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 the tree at 

ftp.freebsd.org:/pub/FreeBSD/FreeBSD-current/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. :)

I've tested on 2.2-stable, but don't have a machine running -current to test 
on.

Thanks,
Mike


--- cut here ---
*** /usr/src/sys/nfs/nfs_vfsops.c	Wed Nov 12 03:14:53 1997
--- ./nfs_vfsops.c	Sat Nov 22 14:33:16 1997
***************
*** 603,608 ****
--- 603,609 ----
  	char pth[MNAMELEN], hst[MNAMELEN];
  	u_int len;
  	u_char nfh[NFSX_V3FHMAX];
+ 	int ncount;
  
  	if (path == NULL) {
  		nfs_mountroot(mp);
***************
*** 638,643 ****
--- 639,650 ----
  	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 = getsockaddr(&nam, (caddr_t)args.addr, args.addrlen);
  	if (error)
--- cut here ---




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