diff options
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 19eb895..0a2b89e 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1044,7 +1044,13 @@ bufwrite(struct buf *bp) else vp_md = 0; - /* Mark the buffer clean */ + /* + * Mark the buffer clean. Increment the bufobj write count + * before bundirty() call, to prevent other thread from seeing + * empty dirty list and zero counter for writes in progress, + * falsely indicating that the bufobj is clean. + */ + bufobj_wref(bp->b_bufobj); bundirty(bp); bp->b_flags &= ~B_DONE; @@ -1052,7 +1058,6 @@ bufwrite(struct buf *bp) bp->b_flags |= B_CACHE; bp->b_iocmd = BIO_WRITE; - bufobj_wref(bp->b_bufobj); vfs_busy_pages(bp, 1); /* |