In vn_vget_ino() and their inline equivalents, mnt_ref() the mount point

around the sequence that drop vnode lock and then busies the mount point.
Not having vlocked node or direct reference to the mp allows for the
forced unmount to proceed, making mp unmounted or reused.

Tested by:	pho
Reviewed by:	jeff
Approved by:	re (kensmith)
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2009-07-02 18:02:55 +00:00
parent 6196f898bb
commit f1eccd05ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195294
4 changed files with 8 additions and 0 deletions

View File

@ -376,9 +376,11 @@ cd9660_lookup(ap)
ltype = VOP_ISLOCKED(pdp);
error = vfs_busy(mp, MBF_NOWAIT);
if (error != 0) {
vfs_ref(mp);
VOP_UNLOCK(pdp, 0);
error = vfs_busy(mp, 0);
vn_lock(pdp, ltype | LK_RETRY);
vfs_rel(mp);
if (error)
return (ENOENT);
if (pdp->v_iflag & VI_DOOMED) {

View File

@ -1307,9 +1307,11 @@ vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp)
("vn_vget_ino: vp not locked"));
error = vfs_busy(mp, MBF_NOWAIT);
if (error != 0) {
vfs_ref(mp);
VOP_UNLOCK(vp, 0);
error = vfs_busy(mp, 0);
vn_lock(vp, ltype | LK_RETRY);
vfs_rel(mp);
if (error != 0)
return (ENOENT);
if (vp->v_iflag & VI_DOOMED) {

View File

@ -1043,9 +1043,11 @@ nfs_lookup(struct vop_lookup_args *ap)
ltype = VOP_ISLOCKED(dvp);
error = vfs_busy(mp, MBF_NOWAIT);
if (error != 0) {
vfs_ref(mp);
VOP_UNLOCK(dvp, 0);
error = vfs_busy(mp, 0);
vn_lock(dvp, ltype | LK_RETRY);
vfs_rel(mp);
if (error == 0 && (dvp->v_iflag & VI_DOOMED)) {
vfs_unbusy(mp);
error = ENOENT;

View File

@ -5104,9 +5104,11 @@ softdep_fsync(vp)
FFSV_FORCEINSMQ)) {
error = vfs_busy(mp, MBF_NOWAIT);
if (error != 0) {
vfs_ref(mp);
VOP_UNLOCK(vp, 0);
error = vfs_busy(mp, 0);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vfs_rel(mp);
if (error != 0)
return (ENOENT);
if (vp->v_iflag & VI_DOOMED) {