]> granicus.if.org Git - zfs/commitdiff
Disable parallel processing for 'zfs mount -l'
authorTom Caputi <tcaputi@datto.com>
Sat, 25 May 2019 20:46:32 +0000 (16:46 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 7 Jun 2019 19:39:13 +0000 (12:39 -0700)
Currently, 'zfs mount -a' will always attempt to parallelize
work related to mounting as best it can. Unfortunately, when
the user passes the '-l' option to load keys, this causes
all threads to prompt the user for their keys at once,
resulting in a confusing and racy user experience. This patch
simply disables parallel mounting when using the '-l' flag.

Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #8762
Closes #8811

cmd/zfs/zfs_main.c

index 6929a224636a1584385f1b2766f7c6e4bf518387..c85154479cbfb82e83ad5f8c1cb2130729a1c9a6 100644 (file)
@@ -6622,10 +6622,13 @@ share_mount(int op, int argc, char **argv)
 
                /*
                 * libshare isn't mt-safe, so only do the operation in parallel
-                * if we're mounting.
+                * if we're mounting. Additionally, the key-loading option must
+                * be serialized so that we can prompt the user for their keys
+                * in a consistent manner.
                 */
                zfs_foreach_mountpoint(g_zfs, cb.cb_handles, cb.cb_used,
-                   share_mount_one_cb, &share_mount_state, op == OP_MOUNT);
+                   share_mount_one_cb, &share_mount_state,
+                   op == OP_MOUNT && !(flags & MS_CRYPT));
                ret = share_mount_state.sm_status;
 
                for (int i = 0; i < cb.cb_used; i++)