From owner-freebsd-current Sat Nov 22 14:53:40 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA01683 for current-outgoing; Sat, 22 Nov 1997 14:53:40 -0800 (PST) (envelope-from owner-freebsd-current) 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 OAA01665 for ; Sat, 22 Nov 1997 14:53:35 -0800 (PST) (envelope-from mburgett@dragon.awen.com) Received: (from mburgett@localhost) by dragon.awen.com (8.8.8/8.8.7) id OAA00371; Sat, 22 Nov 1997 14:53:35 -0800 (PST) Message-Id: <199711222253.OAA00371@dragon.awen.com> From: "Mike Burgett" To: "current@freebsd.org" Date: Sat, 22 Nov 97 14:53:34 -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 mounting the same partition over and over... Sender: owner-freebsd-current@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 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 ---