Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2016 22:14:55 +0000 (UTC)
From:      Ravi Pokala <rpokala@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294853 - stable/10/sys/fs/nandfs
Message-ID:  <201601262214.u0QMEtiY086875@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpokala
Date: Tue Jan 26 22:14:55 2016
New Revision: 294853
URL: https://svnweb.freebsd.org/changeset/base/294853

Log:
  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.

Modified:
  stable/10/sys/fs/nandfs/nandfs_segment.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nandfs/nandfs_segment.c
==============================================================================
--- stable/10/sys/fs/nandfs/nandfs_segment.c	Tue Jan 26 21:35:47 2016	(r294852)
+++ stable/10/sys/fs/nandfs/nandfs_segment.c	Tue Jan 26 22:14:55 2016	(r294853)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601262214.u0QMEtiY086875>