summaryrefslogtreecommitdiffstats
path: root/sys/fs/nwfs
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-05-16 18:04:37 +0000
committeriedowse <iedowse@FreeBSD.org>2001-05-16 18:04:37 +0000
commitdafd513732df8c8fa7b8c5069ae3af2203853494 (patch)
tree57e0aeed936a6069b4a1048d66e40c879871f601 /sys/fs/nwfs
parent7faffe08a53e9fd2e664451fb6634f6377a33a46 (diff)
downloadFreeBSD-src-dafd513732df8c8fa7b8c5069ae3af2203853494.zip
FreeBSD-src-dafd513732df8c8fa7b8c5069ae3af2203853494.tar.gz
Change the second argument of vflush() to an integer that specifies
the number of references on the filesystem root vnode to be both expected and released. Many filesystems hold an extra reference on the filesystem root vnode, which must be accounted for when determining if the filesystem is busy and then released if it isn't busy. The old `skipvp' approach required individual filesystem xxx_unmount functions to re-implement much of vflush()'s logic to deal with the root vnode. All 9 filesystems that hold an extra reference on the root vnode got the logic wrong in the case of forced unmounts, so `umount -f' would always fail if there were any extra root vnode references. Fix this issue centrally in vflush(), now that we can. This commit also fixes a vnode reference leak in devfs, which could result in idle devfs filesystems that refuse to unmount. Reviewed by: phk, bp
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index c9084ef..c978722 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -237,35 +237,16 @@ nwfs_unmount(struct mount *mp, int mntflags, struct proc *p)
{
struct nwmount *nmp = VFSTONWFS(mp);
struct ncp_conn *conn;
- struct vnode *vp;
int error, flags;
NCPVODEBUG("nwfs_unmount: flags=%04x\n",mntflags);
flags = 0;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- error = VFS_ROOT(mp,&vp);
- if (error) return (error);
- if (vp->v_usecount > 2) {
- printf("nwfs_unmount: usecnt=%d\n",vp->v_usecount);
- vput(vp);
- return (EBUSY);
- }
- error = vflush(mp, vp, flags);
- if (error) {
- vput(vp);
+ /* There is 1 extra root vnode reference from nwfs_mount(). */
+ error = vflush(mp, 1, flags);
+ if (error)
return (error);
- }
- /*
- * There are two reference counts and one lock to get rid of here.
- */
- NCPVODEBUG("v_use: %d\n",vp->v_usecount);
- vput(vp);
- NCPVODEBUG("v_use after vput: %d\n",vp->v_usecount);
- vrele(vp);
- NCPVODEBUG("v_use after vrele: %d\n",vp->v_usecount);
- vgone(vp);
- NCPVODEBUG("v_gone finished !!!!\n");
conn = NWFSTOCONN(nmp);
ncp_conn_puthandle(nmp->connh,NULL,0);
if (ncp_conn_lock(conn,p,p->p_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) {
OpenPOWER on IntegriCloud