summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrpokala <rpokala@FreeBSD.org>2016-01-26 22:14:55 +0000
committerrpokala <rpokala@FreeBSD.org>2016-01-26 22:14:55 +0000
commitbc02f60de1091abeae0362336c81727c56674ad7 (patch)
tree654ab0ec23766f7765fa39ad0fb1e12a5f15162d /sys/fs
parent51e2357571c20f7f9e80efd0e460335bc0b546c6 (diff)
downloadFreeBSD-src-bc02f60de1091abeae0362336c81727c56674ad7.zip
FreeBSD-src-bc02f60de1091abeae0362336c81727c56674ad7.tar.gz
MFC r294200: [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 Approved by: jhb Sponsored by: Panasas, Inc.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nandfs/nandfs_segment.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/fs/nandfs/nandfs_segment.c b/sys/fs/nandfs/nandfs_segment.c
index 8b1dc41..22fb7cd 100644
--- a/sys/fs/nandfs/nandfs_segment.c
+++ b/sys/fs/nandfs/nandfs_segment.c
@@ -479,6 +479,7 @@ nandfs_iterate_dirty_vnodes(struct mount *mp, struct nandfs_seginfo *seginfo)
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 *mp, struct nandfs_seginfo *seginfo)
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);
OpenPOWER on IntegriCloud