From owner-svn-src-all@freebsd.org Tue Jan 26 22:14:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D46D6A469A9; Tue, 26 Jan 2016 22:14:56 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1746D71; Tue, 26 Jan 2016 22:14:56 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0QMEtPP086876; Tue, 26 Jan 2016 22:14:55 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0QMEtiY086875; Tue, 26 Jan 2016 22:14:55 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201601262214.u0QMEtiY086875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 26 Jan 2016 22:14:55 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2016 22:14:56 -0000 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);