Don't bomb out when using keylocation=file://

Avoid following the error path when the operation in fact succeeded.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: James Wah <james@laird-wah.net>
Closes #11651
This commit is contained in:
James Wah 2021-03-04 03:28:49 +11:00 committed by Brian Behlendorf
parent e93203e004
commit 94b240bae0
1 changed files with 7 additions and 3 deletions

View File

@ -532,6 +532,8 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
break; break;
case ZFS_KEYLOCATION_URI: case ZFS_KEYLOCATION_URI:
ret = ENOTSUP;
for (handler = uri_handlers; handler->zuh_scheme != NULL; for (handler = uri_handlers; handler->zuh_scheme != NULL;
handler++) { handler++) {
if (strcmp(handler->zuh_scheme, uri_scheme) != 0) if (strcmp(handler->zuh_scheme, uri_scheme) != 0)
@ -544,9 +546,11 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
break; break;
} }
ret = ENOTSUP; if (ret == ENOTSUP) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"URI scheme is not supported")); "URI scheme is not supported"));
goto error;
}
break; break;
default: default: