- Further simplify ffs_sync(). The vnode lock is required for UFS_UPDATE()

so make the code slightly more uniform.  The vnode lock is acquired in
   all cases and now the only difference between VCHR and other is we
   call UFS_UPDATE instead of VOP_FSYNC().
This commit is contained in:
Jeff Roberson 2003-10-05 09:42:24 +00:00
parent cffa37d466
commit ab1f917b53

View File

@ -1160,26 +1160,22 @@ ffs_sync(mp, waitfor, cred, td)
continue;
}
mtx_unlock(&mntvnode_mtx);
if ((error = vget(vp, lockreq, td)) != 0) {
mtx_lock(&mntvnode_mtx);
if (error == ENOENT)
goto loop;
continue;
}
if (vp->v_type != VCHR) {
if ((error = vget(vp, lockreq, td)) != 0) {
mtx_lock(&mntvnode_mtx);
if (error == ENOENT)
goto loop;
continue;
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(vp, 0, td);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp)
restart = 1;
vrele(vp);
} else {
VI_UNLOCK(vp);
/* XXX UFS_UPDATE is not protected by any lock. */
} else
UFS_UPDATE(vp, wait);
mtx_lock(&mntvnode_mtx);
}
VOP_UNLOCK(vp, 0, td);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp)
restart = 1;
vrele(vp);
if (restart)
goto loop;
}