]> granicus.if.org Git - zfs/commitdiff
Wrong error message when removing log device
authorPaul Zuchowski <31706010+PaulZ-98@users.noreply.github.com>
Fri, 8 Jun 2018 01:07:29 +0000 (21:07 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 8 Jun 2018 01:07:29 +0000 (18:07 -0700)
In the case where the pool is loaded without the crypto
keys necessary to playback the intent log, and log device
removal is attempted, a generic busy message is received.
Change the message to inform the user that the datasets
must be mounted.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #7518

lib/libzfs/libzfs_pool.c
module/zfs/zil.c

index 16b30d17755f1dbc7ec775dc18c61ee162781bae..ef98b25bc071d136f56979ad42a77d5abb88706d 100644 (file)
@@ -24,7 +24,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
  * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
- * Copyright (c) 2017 Datto Inc.
+ * Copyright (c) 2018 Datto Inc.
  * Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
  */
 
@@ -3293,11 +3293,26 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
                break;
 
        case EBUSY:
-               zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-                   "Pool busy; removal may already be in progress"));
+               if (islog) {
+                       zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+                           "Mount encrypted datasets to replay logs."));
+               } else {
+                       zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+                           "Pool busy; removal may already be in progress"));
+               }
                (void) zfs_error(hdl, EZFS_BUSY, msg);
                break;
 
+       case EACCES:
+               if (islog) {
+                       zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+                           "Mount encrypted datasets to replay logs."));
+                       (void) zfs_error(hdl, EZFS_BUSY, msg);
+               } else {
+                       (void) zpool_standard_error(hdl, errno, msg);
+               }
+               break;
+
        default:
                (void) zpool_standard_error(hdl, errno, msg);
        }
index da3ee4500055da78a7da021fec17cb53d5d2dc5d..e8adc6d9986483275ea9f0f97f75e48d7ecb70df 100644 (file)
@@ -22,6 +22,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright (c) 2018 Datto Inc.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -3159,7 +3160,7 @@ zil_suspend(const char *osname, void **cookiep)
                mutex_exit(&zilog->zl_lock);
                dsl_dataset_long_rele(dmu_objset_ds(os), suspend_tag);
                dsl_dataset_rele(dmu_objset_ds(os), suspend_tag);
-               return (SET_ERROR(EBUSY));
+               return (SET_ERROR(EACCES));
        }
 
        zilog->zl_suspending = B_TRUE;
@@ -3400,6 +3401,9 @@ zil_reset(const char *osname, void *arg)
        int error;
 
        error = zil_suspend(osname, NULL);
+       /* EACCES means crypto key not loaded */
+       if ((error == EACCES) || (error == EBUSY))
+               return (SET_ERROR(error));
        if (error != 0)
                return (SET_ERROR(EEXIST));
        return (0);