mirror_zfs/lib/libzfs
Serapheim Dimitropoulos 0ae7bfc0a4 zpool_vdev_remove() should handle EALREADY error return
When the vdev properties features was merged an extra check
was added in `spa_vdev_remove_top_check()` which checked
whether the vdev that we want to remove is already being
removed and if so return an EALREADY error.

```
static int
spa_vdev_remove_top_check(vdev_t *vd)
{
	... <snip> ...
	/*
	 * This device is already being removed
	 */
	if (vd->vdev_removing)
		return (SET_ERROR(EALREADY));
```

Before that change we'd still fail with an error but it
was a more generic one - here is the check that failed
later in the same function:
```
	/*
	 * There can not be a removal in progress.
	 */
	if (spa->spa_removing_phys.sr_state == DSS_SCANNING)
		return (SET_ERROR(EBUSY));
```

Changing the error code returned from that function changed
the behavior of the removal's library interface exposed to
the userland - `spa_vdev_remove()` now returns `EZFS_UNKNOWN`
instead of `EZFS_EBUSY` that was returning before.

This patch adds logic to make `spa_vdev_remove()` mindful
of the new EALREADY code and propagating `EZFS_EBUSY`
reverting to the previously established semantics of that
function.

Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #15013
Closes #15129
2023-08-02 08:54:09 -07:00
..
os nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
.gitignore Clean up lib dependencies 2020-07-10 14:26:00 -07:00
libzfs_changelist.c libzfs: add v2 iterator interfaces 2023-04-10 11:53:02 -07:00
libzfs_config.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_crypto.c libzfs: add v2 iterator interfaces 2023-04-10 11:53:02 -07:00
libzfs_dataset.c Fix remount when setting multiple properties. 2023-06-30 08:36:43 -07:00
libzfs_diff.c Add more ANSI colors to libzfs 2023-03-24 10:21:19 -07:00
libzfs_impl.h nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libzfs_import.c nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libzfs_iter.c libzfs: add v2 iterator interfaces 2023-04-10 11:53:02 -07:00
libzfs_mount.c libzfs: add v2 iterator interfaces 2023-04-10 11:53:02 -07:00
libzfs_pool.c zpool_vdev_remove() should handle EALREADY error return 2023-08-02 08:54:09 -07:00
libzfs_sendrecv.c libzfs: add v2 iterator interfaces 2023-04-10 11:53:02 -07:00
libzfs_status.c nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libzfs_util.c Teach zpool scrub to scrub only blocks in error log 2023-05-18 11:59:42 -07:00
libzfs.abi Teach zpool scrub to scrub only blocks in error log 2023-05-18 11:59:42 -07:00
libzfs.pc.in Spruce up pkg-config files for libzfs/libzfs_core 2020-09-04 11:11:18 -07:00
libzfs.suppr Library ABI tracking with abigail 2020-11-17 09:18:52 -08:00
Makefile.am Add generic implementation handling and SHA2 impl 2023-03-02 13:52:21 -08:00
THIRDPARTYLICENSE.openssl Fix typos in lib/ 2019-09-02 17:53:27 -07:00
THIRDPARTYLICENSE.openssl.descrip Encryption patch follow-up 2017-10-11 16:54:48 -04:00