Softdep_fsync() may need to lock parent directory of the synced vnode.

Use inlined (due to FFSV_FORCEINSMQ) version of vn_vget_ino() to prevent
mountpoint from being unmounted and freed while no vnodes are locked.

Tested by:	pho
Approved by:	re (kensmith)
MFC after:	1 month
This commit is contained in:
kib 2009-06-30 10:07:00 +00:00
parent 905d9397a0
commit c424611d79

View File

@ -5102,10 +5102,28 @@ softdep_fsync(vp)
FREE_LOCK(&lk);
if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp,
FFSV_FORCEINSMQ)) {
error = vfs_busy(mp, MBF_NOWAIT);
if (error != 0) {
VOP_UNLOCK(vp, 0);
error = vfs_busy(mp, 0);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (error != 0)
return (ENOENT);
if (vp->v_iflag & VI_DOOMED) {
vfs_unbusy(mp);
return (ENOENT);
}
}
VOP_UNLOCK(vp, 0);
error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE,
&pvp, FFSV_FORCEINSMQ);
vfs_unbusy(mp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
if (error == 0)
vput(pvp);
error = ENOENT;
}
if (error != 0)
return (error);
}