diff options
author | pjd <pjd@FreeBSD.org> | 2006-06-02 20:29:02 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-06-02 20:29:02 +0000 |
commit | deb3721592f9a89c2907a10e62e7eac2ac40857d (patch) | |
tree | fd7902f1c1a7c6a46207a9fea578d3de2f366c93 | |
parent | 2c4f67981e37d4914db61b39de9ce50520b8ab77 (diff) | |
download | FreeBSD-src-deb3721592f9a89c2907a10e62e7eac2ac40857d.zip FreeBSD-src-deb3721592f9a89c2907a10e62e7eac2ac40857d.tar.gz |
Fix a problem introduced in revision 1.220. On mount(2) failure, don't
forget to unbusy file system before its destruction.
This fixes the following warning on mount failure:
Mount point <X> had 1 dangling refs
Tested by: wkoszek
-rw-r--r-- | sys/kern/vfs_mount.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 3f43dd7..205ef6f 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -83,7 +83,7 @@ static int vfs_mountroot_try(const char *mountfrom); static int vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions); static void free_mntarg(struct mntarg *ma); -static void vfs_mount_destroy(struct mount *, struct thread *); +static void vfs_mount_destroy(struct mount *); static int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); static int usermount = 0; @@ -486,11 +486,10 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, * Destroy the mount struct previously allocated by vfs_mount_alloc(). */ static void -vfs_mount_destroy(struct mount *mp, struct thread *td) +vfs_mount_destroy(struct mount *mp) { int i; - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL, td); MNT_ILOCK(mp); for (i = 0; mp->mnt_ref && i < 3; i++) msleep(mp, MNT_MTX(mp), PVFS, "mntref", hz); @@ -1009,7 +1008,8 @@ vfs_domount( VI_LOCK(vp); vp->v_iflag &= ~VI_MOUNT; VI_UNLOCK(vp); - vfs_mount_destroy(mp, td); + vfs_unbusy(mp, td); + vfs_mount_destroy(mp); vput(vp); } return (error); @@ -1211,7 +1211,8 @@ dounmount(mp, flags, td) vput(coveredvp); } vfs_event_signal(NULL, VQ_UNMOUNT, 0); - vfs_mount_destroy(mp, td); + lockmgr(&mp->mnt_lock, LK_RELEASE, NULL, td); + vfs_mount_destroy(mp); return (0); } |