diff options
author | attilio <attilio@FreeBSD.org> | 2012-11-19 20:43:19 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2012-11-19 20:43:19 +0000 |
commit | e331787780eea9671a3c0fa076f46f68aed00b42 (patch) | |
tree | 7b66d9dcae0e215770f013c034b2664b46a44410 | |
parent | 4e78de3f1a018269f50c0aabf6c186898b96dd6d (diff) | |
download | FreeBSD-src-e331787780eea9671a3c0fa076f46f68aed00b42.zip FreeBSD-src-e331787780eea9671a3c0fa076f46f68aed00b42.tar.gz |
insmntque() is always called with the lock held in exclusive mode,
then:
- assume the lock is held in exclusive mode and remove a moot check
about the lock acquisition.
- in the destructor remove !MPSAFE specific chunk.
Reviewed by: kib
MFC after: 2 weeks
-rw-r--r-- | sys/kern/vfs_subr.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 179b7f4..f1a0d34 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1111,10 +1111,6 @@ insmntque_stddtr(struct vnode *vp, void *dtr_arg) vp->v_data = NULL; vp->v_op = &dead_vnodeops; - /* XXX non mp-safe fs may still call insmntque with vnode - unlocked */ - if (!VOP_ISLOCKED(vp)) - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vgone(vp); vput(vp); } @@ -1126,7 +1122,6 @@ int insmntque1(struct vnode *vp, struct mount *mp, void (*dtr)(struct vnode *, void *), void *dtr_arg) { - int locked; KASSERT(vp->v_mount == NULL, ("insmntque: vnode already on per mount vnode list")); @@ -1144,18 +1139,15 @@ insmntque1(struct vnode *vp, struct mount *mp, */ MNT_ILOCK(mp); VI_LOCK(vp); - if ((mp->mnt_kern_flag & MNTK_NOINSMNTQ) != 0 && + if (((mp->mnt_kern_flag & MNTK_NOINSMNTQ) != 0 && ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0 || - mp->mnt_nvnodelistsize == 0)) { - locked = VOP_ISLOCKED(vp); - if (!locked || (locked == LK_EXCLUSIVE && - (vp->v_vflag & VV_FORCEINSMQ) == 0)) { - VI_UNLOCK(vp); - MNT_IUNLOCK(mp); - if (dtr != NULL) - dtr(vp, dtr_arg); - return (EBUSY); - } + mp->mnt_nvnodelistsize == 0)) && + (vp->v_vflag & VV_FORCEINSMQ) == 0) { + VI_UNLOCK(vp); + MNT_IUNLOCK(mp); + if (dtr != NULL) + dtr(vp, dtr_arg); + return (EBUSY); } vp->v_mount = mp; MNT_REF(mp); |