aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/contrib/opensolaris/uts
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2019-06-03 17:27:25 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-06-03 17:27:25 +0000
commitc066dcc0743c61c46757e1336bba8dd44bb7ffa2 (patch)
tree5327f238d96b4dd3cb2ee916e91b5ea0e0d1d214 /sys/cddl/contrib/opensolaris/uts
parentc4af53b8f1537e01f1b8d9e5ca146a17bee197df (diff)
parent740701f1c4a0d7e5baa0edab5bcc3264d0de7180 (diff)
MFV r348535: 9677 panic from zio_write_gang_block() when creating dump device on fragmented rpool
illumos/illumos-gate@7341a7de4f0489193e0cfe11049a7bcf1596a4db Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Prashanth Sreenivasa <pks@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: Brad Lewis <brad.lewis@delphix.com>
Notes
Notes: svn path=/head/; revision=348558
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
index 50cadae20ac9..ded3a63163b2 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
@@ -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