Skip to content

Commit

Permalink
Ignore errors due to sharesmb on pool import
Browse files Browse the repository at this point in the history
For users who have sharesmb property set to on,
when trying to import the pool on TrueNAS, they
run into error and pool import fails because the
samba usershares path on Linux, i.e.
/var/lib/samba/usershares does not exist on
TrueNAS SCALE.

To resolve this issue, do not return the error
while enabling the SMB shares, instead print the
error message and continue. Since we rely on
middleware to manage the SMB shares, returing
the error results in failure of overall command,
even though imported pool shows up in zpool list.

Signed-off-by: Umer Saleem <[email protected]>
  • Loading branch information
usaleem-ix committed Aug 15, 2023
1 parent b2e707c commit 4b5105a
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,26 @@ zfs_share(zfs_handle_t *zhp, const enum sa_protocol *proto)
err = sa_enable_share(zfs_get_name(zhp), mountpoint, shareopts,
*curr_proto);
if (err != SA_OK) {
return (zfs_error_fmt(zhp->zfs_hdl,
proto_table[*curr_proto].p_share_err,
dgettext(TEXT_DOMAIN, "cannot share '%s: %s'"),
zfs_get_name(zhp), sa_errorstr(err)));
/*
* For TrueNAS, do not return the error encountered
* while enabling the SMB share, instead print the
* error message and continue. We rely on middleware
* to manage the SMB shares. Returning this error
* from here results in failure of overall command,
* even though pool shows up in zpool list.
*/
if (proto_table[*curr_proto].p_prop == ZFS_PROP_SHARESMB)

Check failure on line 749 in lib/libzfs/libzfs_mount.c

View workflow job for this annotation

GitHub Actions / checkstyle

line > 80 characters
zfs_error_fmt(zhp->zfs_hdl,
proto_table[*curr_proto].p_share_err,
dgettext(TEXT_DOMAIN,
"cannot share '%s: %s'"),
zfs_get_name(zhp), sa_errorstr(err));
else
return (zfs_error_fmt(zhp->zfs_hdl,
proto_table[*curr_proto].p_share_err,
dgettext(TEXT_DOMAIN,
"cannot share '%s: %s'"),
zfs_get_name(zhp), sa_errorstr(err)));
}

}
Expand Down

0 comments on commit 4b5105a

Please sign in to comment.