* dounmount() wasn't properly locked, make it grab the mntvnode_token
* It is necessary to synchronize against insmntque() clearing the vnode
linkage
* This commit fixes issue #2506
Thanks to vsrinivas for directions
int lflags;
int freeok = 1;
+ lwkt_gettoken(&mntvnode_token);
/*
* Exclusive access for unmounting purposes
*/
if ((error = mountlist_interlock(dounmount_interlock, mp)) != 0)
- return (error);
+ goto out;
/*
* Allow filesystems to detect that a forced unmount is in progress.
mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_UNMOUNTF);
if (mp->mnt_kern_flag & MNTK_MWAIT)
wakeup(mp);
- return (error);
+ goto out;
}
if (mp->mnt_flag & MNT_EXPUBLIC)
lockmgr(&mp->mnt_lock, LK_RELEASE);
if (mp->mnt_kern_flag & MNTK_MWAIT)
wakeup(mp);
- return (error);
+ goto out;
}
/*
* Clean up any journals still associated with the mount after
wakeup(mp);
if (freeok)
kfree(mp, M_MOUNT);
- return (0);
+ error = 0;
+out:
+ lwkt_reltoken(&mntvnode_token);
+ return (error);
}
static