diff options
-rw-r--r-- | cmd/zfs/zfs_main.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 9357bd2f3..634303f80 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -6580,8 +6580,25 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, return (1); } - if (zfs_mount(zhp, options, flags) != 0) + if (zfs_mount(zhp, options, flags) != 0) { + /* + * Check if a mount sneaked in after we checked + */ + if (!explicit && + libzfs_errno(g_zfs) == EZFS_MOUNTFAILED) { + usleep(10 * MILLISEC); + libzfs_mnttab_cache(g_zfs, B_FALSE); + + if (zfs_is_mounted(zhp, NULL)) { + (void) fprintf(stderr, gettext( + "Ignoring previous 'already " + "mounted' error for '%s'\n"), + zfs_get_name(zhp)); + return (0); + } + } return (1); + } break; } |