From owner-svn-src-user@FreeBSD.ORG Sun Nov 8 21:42:02 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B82D106568F; Sun, 8 Nov 2009 21:42:02 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50EED8FC19; Sun, 8 Nov 2009 21:42:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nA8Lg0Io098892; Sun, 8 Nov 2009 21:42:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA8Lg0u1098890; Sun, 8 Nov 2009 21:42:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200911082142.nA8Lg0u1098890@svn.freebsd.org> From: Kip Macy Date: Sun, 8 Nov 2009 21:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199064 - user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2009 21:42:02 -0000 Author: kmacy Date: Sun Nov 8 21:42:00 2009 New Revision: 199064 URL: http://svn.freebsd.org/changeset/base/199064 Log: validate bp before checking or setting flags Modified: user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Nov 8 21:31:36 2009 (r199063) +++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Nov 8 21:42:00 2009 (r199064) @@ -2708,9 +2708,11 @@ arc_read_done(zio_t *zio) arc_cksum_compute(buf, B_FALSE); - buf->b_bp->b_flags &= ~B_INVAL; - buf->b_bp->b_flags |= B_CACHE; - + if (buf->b_bp != NULL) { + buf->b_bp->b_flags &= ~B_INVAL; + buf->b_bp->b_flags |= B_CACHE; + } + /* create copies of the data buffer for the callers */ abuf = buf; for (acb = callback_list; acb; acb = acb->acb_next) { @@ -2969,16 +2971,18 @@ top: * We hit in the page cache * */ - if ((buf->b_bp->b_flags & (B_CACHE|B_INVAL)) == B_CACHE) { - /* - * track the number of times - * the buffer was found in the cache - */ - ARCSTAT_BUMP(arcstat_page_cache_hits); - mutex_exit(hash_lock); - goto top; - } else + if (buf->b_bp != NULL) { + if ((buf->b_bp->b_flags & (B_CACHE|B_INVAL)) == B_CACHE) { + /* + * track the number of times + * the buffer was found in the cache + */ + ARCSTAT_BUMP(arcstat_page_cache_hits); + mutex_exit(hash_lock); + goto top; + } buf->b_bp->b_offset = bp->blk_birth; + } acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP); acb->acb_done = done; @@ -3449,6 +3453,7 @@ arc_write_done(zio_t *zio) exists = buf_hash_insert(hdr, &hash_lock); ASSERT3P(exists, ==, NULL); } else if ((hdr->b_buf == buf) && + (bp != NULL) && (bp->b_bufobj == NULL) && (bp->b_bcount >= PAGE_SIZE)) { arc_binval(buf, blkno, vp, bp->b_bcount, bp);