- Add a missing vn_start_write() to flushbufqueues(). This could have
caused snapshot related problems. - The vp can not be NULL here or we would panic in vfs_bio_awrite(). Stop confusing the logic by checking for it in several places. Submitted by: kirk and then rototilled by me to remove vp == NULL checks.
This commit is contained in:
parent
87f4fa1512
commit
d1cf0fc7fc
@ -2135,6 +2135,7 @@ flushbufqueues(int flushdeps)
|
|||||||
{
|
{
|
||||||
struct thread *td = curthread;
|
struct thread *td = curthread;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
|
struct mount *mp;
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
int hasdeps;
|
int hasdeps;
|
||||||
|
|
||||||
@ -2176,12 +2177,16 @@ flushbufqueues(int flushdeps)
|
|||||||
* of vnode followed by buf lock. This is ok because
|
* of vnode followed by buf lock. This is ok because
|
||||||
* the NOWAIT will prevent deadlock.
|
* the NOWAIT will prevent deadlock.
|
||||||
*/
|
*/
|
||||||
if ((vp = bp->b_vp) == NULL ||
|
vp = bp->b_vp;
|
||||||
vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) {
|
if (vn_start_write(vp, &mp, V_NOWAIT) != 0) {
|
||||||
|
BUF_UNLOCK(bp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) {
|
||||||
mtx_unlock(&bqlock);
|
mtx_unlock(&bqlock);
|
||||||
vfs_bio_awrite(bp);
|
vfs_bio_awrite(bp);
|
||||||
if (vp != NULL)
|
vn_finished_write(mp);
|
||||||
VOP_UNLOCK(vp, 0, td);
|
VOP_UNLOCK(vp, 0, td);
|
||||||
flushwithdeps += hasdeps;
|
flushwithdeps += hasdeps;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user