From owner-freebsd-stable Sat Nov 22 14:49:05 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA01479 for stable-outgoing; Sat, 22 Nov 1997 14:49:05 -0800 (PST) (envelope-from owner-freebsd-stable) Received: from dragon.awen.com (dragon.awen.com [207.33.155.10]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA01460 for ; Sat, 22 Nov 1997 14:48:59 -0800 (PST) (envelope-from mburgett@dragon.awen.com) Received: (from mburgett@localhost) by dragon.awen.com (8.8.8/8.8.7) id OAA00338; Sat, 22 Nov 1997 14:48:59 -0800 (PST) Message-Id: <199711222248.OAA00338@dragon.awen.com> From: "Mike Burgett" To: "stable@freebsd.org" Date: Sat, 22 Nov 97 14:48:58 -0800 Reply-To: "Mike Burgett" Priority: Normal X-Mailer: PMMail 1.92 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: nfs and mounting more than once... Sender: owner-freebsd-stable@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 ----