svn commit: r294200 - head/sys/fs/nandfs
Ravi Pokala
rpokala at FreeBSD.org
Sun Jan 17 01:04:21 UTC 2016
Author: rpokala
Date: Sun Jan 17 01:04:20 2016
New Revision: 294200
URL: https://svnweb.freebsd.org/changeset/base/294200
Log:
[PR 206224] bv_cnt is sometimes examined without holding the bufobj lock
Add locking around access to bv_cnt which is currently being done unlocked
PR: 206224
Reviewed by: imp
Approved by: jhb
MFC after: 1 week
Sponsored by: Panasas, Inc.
Differential Revision: https://reviews.freebsd.org/D4931
Modified:
head/sys/fs/nandfs/nandfs_segment.c
Modified: head/sys/fs/nandfs/nandfs_segment.c
==============================================================================
--- head/sys/fs/nandfs/nandfs_segment.c Sun Jan 17 00:52:28 2016 (r294199)
+++ head/sys/fs/nandfs/nandfs_segment.c Sun Jan 17 01:04:20 2016 (r294200)
@@ -479,6 +479,7 @@ nandfs_iterate_dirty_vnodes(struct mount
struct nandfs_node *nandfs_node;
struct vnode *vp, *mvp;
struct thread *td;
+ struct bufobj *bo;
int error, update;
td = curthread;
@@ -499,17 +500,21 @@ nandfs_iterate_dirty_vnodes(struct mount
update = 1;
}
+ bo = &vp->v_bufobj;
+ BO_LOCK(bo);
if (vp->v_bufobj.bo_dirty.bv_cnt) {
error = nandfs_iterate_dirty_buf(vp, seginfo, 0);
if (error) {
nandfs_error("%s: cannot iterate vnode:%p "
"err:%d\n", __func__, vp, error);
vput(vp);
+ BO_UNLOCK(bo);
return (error);
}
update = 1;
} else
vput(vp);
+ BO_UNLOCK(bo);
if (update)
nandfs_node_update(nandfs_node);
More information about the svn-src-all
mailing list