From owner-svn-src-head@freebsd.org Sun Jan 17 01:04:21 2016 Return-Path: Delivered-To: svn-src-head@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 94089A830C7; Sun, 17 Jan 2016 01:04:21 +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 615CC1871; Sun, 17 Jan 2016 01:04:21 +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 u0H14K0Y081759; Sun, 17 Jan 2016 01:04:20 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0H14KaY081758; Sun, 17 Jan 2016 01:04:20 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201601170104.u0H14KaY081758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Sun, 17 Jan 2016 01:04:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294200 - head/sys/fs/nandfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jan 2016 01:04:21 -0000 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);