diff --git a/contrib/debian/rules.in b/contrib/debian/rules.in index 9ff28b663b5f..4fc02fa1e565 100755 --- a/contrib/debian/rules.in +++ b/contrib/debian/rules.in @@ -168,7 +168,7 @@ override_dh_installinit: dh_installinit -r --no-restart-after-upgrade --name zfs-import dh_installinit -r --no-restart-after-upgrade --name zfs-mount dh_installinit -r --no-restart-after-upgrade --name zfs-load-key - dh_installinit -R --name zfs-share + dh_installinit --no-start --no-enable --name zfs-share dh_installinit -R --name zfs-zed override_dh_installsystemd: diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c index dd14c570ec03..8414da108a2d 100644 --- a/lib/libzfs/libzfs_changelist.c +++ b/lib/libzfs/libzfs_changelist.c @@ -154,7 +154,7 @@ changelist_prefix(prop_changelist_t *clp) uu_avl_walk_end(walk); if (ret == -1) - (void) changelist_postfix(clp); + (void) changelist_postfix(clp, NULL); return (ret); } @@ -169,12 +169,13 @@ changelist_prefix(prop_changelist_t *clp) * filesystem. */ int -changelist_postfix(prop_changelist_t *clp) +changelist_postfix(prop_changelist_t *clp, int *s_status) { prop_changenode_t *cn; uu_avl_walk_t *walk; char shareopts[ZFS_MAXPROPLEN]; int errors = 0; + int ret = 0; boolean_t commit_smb_shares = B_FALSE; boolean_t commit_nfs_shares = B_FALSE; @@ -262,7 +263,11 @@ changelist_postfix(prop_changelist_t *clp) const enum sa_protocol nfs[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; if (sharenfs && mounted) { - errors += zfs_share(cn->cn_handle, nfs); + ret = zfs_share(cn->cn_handle, nfs); + if (ret != 0 && s_status != NULL) { + *s_status = EZFS_SHARENFSFAILED; + errors += ret; + } commit_nfs_shares = B_TRUE; } else if (cn->cn_shared || clp->cl_waslegacy) { errors += zfs_unshare(cn->cn_handle, NULL, nfs); @@ -271,7 +276,11 @@ changelist_postfix(prop_changelist_t *clp) const enum sa_protocol smb[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; if (sharesmb && mounted) { - errors += zfs_share(cn->cn_handle, smb); + ret = zfs_share(cn->cn_handle, smb); + if (ret != 0 && s_status != NULL) { + *s_status = EZFS_SHARESMBFAILED; + errors += ret; + } commit_smb_shares = B_TRUE; } else if (cn->cn_shared || clp->cl_waslegacy) { errors += zfs_unshare(cn->cn_handle, NULL, smb); diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 11d3eb6a3c60..2a7aa405e043 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1789,6 +1789,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) nvlist_t *nvl; int nvl_len = 0; int added_resv = 0; + int s_status = 0; zfs_prop_t prop; boolean_t nsprop = B_FALSE; nvpair_t *elem; @@ -1918,8 +1919,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) } else { for (cl_idx = 0; cl_idx < nvl_len; cl_idx++) { if (cls[cl_idx] != NULL) { - int clp_err = changelist_postfix(cls[cl_idx]); - if (clp_err != 0) + int clp_err = changelist_postfix(cls[cl_idx], + &s_status); + if (clp_err != 0 && s_status == 0) ret = clp_err; } } @@ -2044,7 +2046,7 @@ zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received) return (zfs_standard_error(hdl, errno, errbuf)); } else { - if ((ret = changelist_postfix(cl)) != 0) + if ((ret = changelist_postfix(cl, NULL)) != 0) goto error; /* @@ -4334,7 +4336,7 @@ rollback_destroy_dependent(zfs_handle_t *zhp, void *data) cbp->cb_error = B_TRUE; else changelist_remove(clp, zhp->zfs_name); - (void) changelist_postfix(clp); + (void) changelist_postfix(clp, NULL); changelist_free(clp); zfs_close(zhp); @@ -4647,11 +4649,11 @@ zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) * were previously mounted, so we don't alter the system state. */ if (cl != NULL) - (void) changelist_postfix(cl); + (void) changelist_postfix(cl, NULL); } else { if (cl != NULL) { changelist_rename(cl, zfs_get_name(zhp), target); - ret = changelist_postfix(cl); + ret = changelist_postfix(cl, NULL); } } diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index ef0359f45ea0..706082bbdfe1 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -169,7 +169,7 @@ extern int zcmd_read_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t **); extern void zcmd_free_nvlists(zfs_cmd_t *); extern int changelist_prefix(prop_changelist_t *); -extern int changelist_postfix(prop_changelist_t *); +extern int changelist_postfix(prop_changelist_t *, int *); extern void changelist_rename(prop_changelist_t *, const char *, const char *); extern void changelist_remove(prop_changelist_t *, const char *); extern void changelist_free(prop_changelist_t *); diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 87a30f54fea8..074c7319e2b9 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -2984,7 +2984,7 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname, (void) printf("failed (%u)\n", errno); } - (void) changelist_postfix(clp); + (void) changelist_postfix(clp, NULL); out: if (clp != NULL) @@ -3089,7 +3089,7 @@ recv_destroy(libzfs_handle_t *hdl, const char *name, int baselen, changelist_remove(clp, name); } - (void) changelist_postfix(clp); + (void) changelist_postfix(clp, NULL); changelist_free(clp); /* @@ -5238,7 +5238,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, */ if (clp) { if (!flags->nomount) - err |= changelist_postfix(clp); + err |= changelist_postfix(clp, NULL); changelist_free(clp); } @@ -5549,7 +5549,7 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props, } /* mount and share received datasets */ - err = changelist_postfix(clp); + err = changelist_postfix(clp, NULL); changelist_free(clp); if (err != 0) err = -1;