From owner-svn-src-stable-12@freebsd.org Tue Jun 11 14:18:05 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A3815BC3E4; Tue, 11 Jun 2019 14:18:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17AC88D9C8; Tue, 11 Jun 2019 14:18:05 +0000 (UTC) (envelope-from mav@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEAC42B33; Tue, 11 Jun 2019 14:18:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5BEI47w009772; Tue, 11 Jun 2019 14:18:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5BEI4Be009771; Tue, 11 Jun 2019 14:18:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906111418.x5BEI4Be009771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Jun 2019 14:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348908 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 348908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 17AC88D9C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2019 14:18:05 -0000 Author: mav Date: Tue Jun 11 14:18:04 2019 New Revision: 348908 URL: https://svnweb.freebsd.org/changeset/base/348908 Log: MFC r348558: MFV r348535: 9677 panic from zio_write_gang_block() when creating dump device on fragmented rpool illumos/illumos-gate@7341a7de4f0489193e0cfe11049a7bcf1596a4db Reviewed by: Matt Ahrens Reviewed by: George Wilson Reviewed by: Prashanth Sreenivasa Approved by: Robert Mustacchi Author: Brad Lewis Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Jun 11 14:17:05 2019 (r348907) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Jun 11 14:18:04 2019 (r348908) @@ -2319,7 +2319,13 @@ zio_write_gang_member_ready(zio_t *zio) static void zio_write_gang_done(zio_t *zio) { - abd_put(zio->io_abd); + /* + * The io_abd field will be NULL for a zio with no data. The io_flags + * will initially have the ZIO_FLAG_NODATA bit flag set, but we can't + * check for it here as it is cleared in zio_ready. + */ + if (zio->io_abd != NULL) + abd_put(zio->io_abd); } static zio_t * @@ -2340,11 +2346,12 @@ zio_write_gang_block(zio_t *pio) int gbh_copies = MIN(copies + 1, spa_max_replication(spa)); zio_prop_t zp; int error; + boolean_t has_data = !(pio->io_flags & ZIO_FLAG_NODATA); int flags = METASLAB_HINTBP_FAVOR | METASLAB_GANG_HEADER; if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) { ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE); - ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA)); + ASSERT(has_data); flags |= METASLAB_ASYNC_ALLOC; VERIFY(refcount_held(&mc->mc_alloc_slots[pio->io_allocator], @@ -2368,7 +2375,7 @@ zio_write_gang_block(zio_t *pio) if (error) { if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) { ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE); - ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA)); + ASSERT(has_data); /* * If we failed to allocate the gang block header then @@ -2421,14 +2428,15 @@ zio_write_gang_block(zio_t *pio) zp.zp_nopwrite = B_FALSE; zio_t *cio = zio_write(zio, spa, txg, &gbh->zg_blkptr[g], - abd_get_offset(pio->io_abd, pio->io_size - resid), lsize, - lsize, &zp, zio_write_gang_member_ready, NULL, NULL, + has_data ? abd_get_offset(pio->io_abd, pio->io_size - + resid) : NULL, lsize, lsize, &zp, + zio_write_gang_member_ready, NULL, NULL, zio_write_gang_done, &gn->gn_child[g], pio->io_priority, ZIO_GANG_CHILD_FLAGS(pio), &pio->io_bookmark); if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) { ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE); - ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA)); + ASSERT(has_data); /* * Gang children won't throttle but we should