diff options
author | Chunwei Chen <[email protected]> | 2017-07-24 12:49:27 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-07-24 12:49:27 -0700 |
commit | 83a5e4d6b9c2509efa25ea4cfceba3cd313bf920 (patch) | |
tree | 3d95bb2c55cb9f004eb32029af4924c1faccddc1 | |
parent | d6bcf7ff5e97df3195d34269b1b72952b4a00778 (diff) |
Fix don't zero_label when replace with spare
When replacing a disk with non-wholedisk spare, we shouldn't zero_label
it. The wholedisk case already skip it. In fact, zero_label function
will fail saying device busy because it's already opened exclusively,
but since there's no error checking, the replace command will succeed,
causing great confusion.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #6369
-rw-r--r-- | cmd/zpool/zpool_vdev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index b0b639684..4c3793d6e 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -1227,7 +1227,8 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) if (is_mpath_whole_disk(path)) update_vdev_config_dev_strs(nv); - (void) zero_label(path); + if (!is_spare(NULL, path)) + (void) zero_label(path); return (0); } |