aboutsummaryrefslogtreecommitdiff
path: root/lib/libzfs/libzfs_pool.c
diff options
context:
space:
mode:
authorBrian Behlendorf <behlendorf1@llnl.gov>2012-05-31 19:42:51 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2012-06-01 15:55:24 +0000
commitabe5b8fb669dfb30134e09d797665bb43b60fc2a (patch)
tree81aa502097288f36a966ebc1601386d8194116fa /lib/libzfs/libzfs_pool.c
parentb04c9fc009ca0a0cabb7550625ff273b9edd9729 (diff)
downloadsrc-abe5b8fb669dfb30134e09d797665bb43b60fc2a.tar.gz
src-abe5b8fb669dfb30134e09d797665bb43b60fc2a.zip
Improve 'zpool import' EBUSY error message
When a device is already open O_EXCL by another process the `zpool import` will correctly fail. However, the default failure message isn't very helpful. It may in fact be harmful if you take its advise and destroy your pool. cannot import 'tank': pool is busy Destroy and re-create the pool from a backup source. Improve the error message in the EBUSY case to simply print a message indicating that the devices are current in use. The user will need to manually identify which process has the device open exclusively and why. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r--lib/libzfs/libzfs_pool.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index 0a2dca0adbeb..7b78f25f0007 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -1585,6 +1585,12 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
(void) zpool_standard_error(hdl, error, desc);
break;
+ case EBUSY:
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "one or more devices are already in use\n"));
+ (void) zfs_error(hdl, EZFS_BADDEV, desc);
+ break;
+
default:
(void) zpool_standard_error(hdl, error, desc);
zpool_explain_recover(hdl,