Bug 225546 - "zpool add" crashes in the presence of a replacing vdev with a spare child
Summary: "zpool add" crashes in the presence of a replacing vdev with a spare child
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Alan Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-29 23:09 UTC by Alan Somers
Modified: 2018-03-10 04:03 UTC (History)
1 user (show)

See Also:
asomers: mfc-stable11+
asomers: mfc-stable10+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2018-01-29 23:09:14 UTC
If a pool contains a replacing vdev with a spare child, then any "zpool add" command will fail.  It doesn't matter whether you're adding a regular vdev, log, cache, or spare vdev.  The bug is in get_replication in zpool_vdev.c in the zpool command.

zpool status bar
        pool: bar
        state: DEGRADED
        status: One or more devices is currently being resilvered. The pool will
        continue to function, possibly in a degraded state.
        action: Wait for the resilver to complete.
        scan: resilver in progress since Wed Dec 6 22:32:52 2017
        17.7G scanned out of 4.24T at 534M/s, 2h18m to go
        11.8G resilvered, 0.41% done
        config:

    NAME STATE READ WRITE CKSUM
    bar DEGRADED 0 0 0
    raidz1-0 DEGRADED 0 0 0
    replacing-0 DEGRADED 0 0 0
    spare-0 REMOVED 0 0 0
    4444235316927249078 REMOVED 0 0 0 was /dev/da0
    da5 ONLINE 0 0 0 (resilvering)
    da4 ONLINE 0 0 0 (resilvering)
    da1 ONLINE 0 0 0
    da2 ONLINE 0 0 0
    da3 ONLINE 0 0 0
    spares
    17011840191929354180 INUSE currently in use was /dev/da5

    errors: No known data errors

zpool add bar log da6
        Assertion failed: (nvlist_lookup_string(cnv, "path", &path) == 0), file /usr/home/alans/freebsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c, line 694.
        Abort(coredump)
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-01-29 23:21:17 UTC
A commit references this bug:

Author: asomers
Date: Mon Jan 29 23:20:30 UTC 2018
New revision: 328569
URL: https://svnweb.freebsd.org/changeset/base/328569

Log:
  Add a regression test for PR 225546

  If a pool contains a replacing vdev with a spare child, then any "zpool
  add" command will fail.  It doesn't matter whether you're adding a
  regular vdev, log, cache, or spare vdev.  The bug is in get_replication
  in zpool_vdev.c in the zpool command.

  tests/sys/cddl/zfs/tests/cli_root/zpool_add/Makefile
  tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh
  tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh
  	Add a test case that creates a pool with replacing vdev that has
  	a spare child, then attempts to add another spare.

  tests/sys/cddl/zfs/include/commands.txt
  	Add an alias for /usr/bin/timeout

  PR:		225546
  Sponsored by:	Spectra Logic Corp

Changes:
  projects/zfsd/head/tests/sys/cddl/zfs/include/commands.txt
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/Makefile
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-01-30 14:55:01 UTC
A commit references this bug:

Author: danfe
Date: Tue Jan 30 14:54:31 UTC 2018
New revision: 460390
URL: https://svnweb.freebsd.org/changeset/ports/460390

Log:
  Update `sysutils/xorriso' to version 1.4.8.

  PR:		225546
  Submitted by:	benno

Changes:
  head/sysutils/xorriso/Makefile
  head/sysutils/xorriso/distinfo
  head/sysutils/xorriso/pkg-plist
Comment 3 Alan Somers freebsd_committer freebsd_triage 2018-01-30 15:28:58 UTC
danfe I think you may want to double check the PR number for xorriso.
Comment 4 Alexey Dokuchaev freebsd_committer freebsd_triage 2018-01-30 15:35:44 UTC
Yup, I already did, mea culpa (typo 8 -> 6).
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-02-09 16:09:27 UTC
A commit references this bug:

Author: asomers
Date: Fri Feb  9 16:08:57 UTC 2018
New revision: 329067
URL: https://svnweb.freebsd.org/changeset/base/329067

Log:
  Fix "zpool add" crash when a replacing vdev has a spare child

  Fix an assertion in zpool that causes a crash when running any "zpool add"
  command on a spare that contains a replacing vdev with a spare child.

  This likely affects Illumos, too.

  PR:		225546
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14138

Changes:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-03-10 03:05:15 UTC
A commit references this bug:

Author: asomers
Date: Sat Mar 10 03:04:49 UTC 2018
New revision: 330728
URL: https://svnweb.freebsd.org/changeset/base/330728

Log:
  MFC r329067:

  Fix "zpool add" crash when a replacing vdev has a spare child

  Fix an assertion in zpool that causes a crash when running any "zpool add"
  command on a spare that contains a replacing vdev with a spare child.

  This likely affects Illumos, too.

  PR:		225546
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14138

Changes:
_U  stable/11/
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-03-10 04:03:14 UTC
A commit references this bug:

Author: asomers
Date: Sat Mar 10 04:02:51 UTC 2018
New revision: 330735
URL: https://svnweb.freebsd.org/changeset/base/330735

Log:
  MFC r329067:

  Fix "zpool add" crash when a replacing vdev has a spare child

  Fix an assertion in zpool that causes a crash when running any "zpool add"
  command on a spare that contains a replacing vdev with a spare child.

  This likely affects Illumos, too.

  PR:		225546
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14138

Changes:
_U  stable/10/
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c