Make mount/share errors non-fatal for zfs create/clone

If zfs_mount_and_share() fails, the error propagates to zfs create/clone
commands despite successful operation. If create/clone operations were
successful, there's no point in making zfs_mount_and_share() failures
fatal.

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17799
This commit is contained in:
Ameer Hamza 2025-10-02 20:24:26 +05:00 committed by Tony Hutter
parent b9d1e28a71
commit 1585a10a85

View File

@ -914,7 +914,11 @@ zfs_do_clone(int argc, char **argv)
log_history = B_FALSE;
}
ret = zfs_mount_and_share(g_zfs, argv[1], ZFS_TYPE_DATASET);
/*
* Dataset cloned successfully, mount/share failures are
* non-fatal.
*/
(void) zfs_mount_and_share(g_zfs, argv[1], ZFS_TYPE_DATASET);
}
zfs_close(zhp);
@ -1333,7 +1337,9 @@ zfs_do_create(int argc, char **argv)
goto error;
}
ret = zfs_mount_and_share(g_zfs, argv[0], ZFS_TYPE_DATASET);
/* Dataset created successfully, mount/share failures are non-fatal */
ret = 0;
(void) zfs_mount_and_share(g_zfs, argv[0], ZFS_TYPE_DATASET);
error:
nvlist_free(props);
return (ret);