Fix remount when setting multiple properties.

The previous code was checking zfs_is_namespace_prop() only for the
last property on the list.  If one was not "namespace", then remount
wasn't called.  To fix that move zfs_is_namespace_prop() inside the
loop and remount if at least one of properties was "namespace".

Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15000
This commit is contained in:
Alexander Motin 2023-06-30 11:36:43 -04:00 committed by GitHub
parent 24554082bd
commit eda32dca92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1789,7 +1789,8 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
nvlist_t *nvl; nvlist_t *nvl;
int nvl_len = 0; int nvl_len = 0;
int added_resv = 0; int added_resv = 0;
zfs_prop_t prop = 0; zfs_prop_t prop;
boolean_t nsprop = B_FALSE;
nvpair_t *elem; nvpair_t *elem;
(void) snprintf(errbuf, sizeof (errbuf), (void) snprintf(errbuf, sizeof (errbuf),
@ -1836,6 +1837,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
elem = nvlist_next_nvpair(nvl, elem)) { elem = nvlist_next_nvpair(nvl, elem)) {
prop = zfs_name_to_prop(nvpair_name(elem)); prop = zfs_name_to_prop(nvpair_name(elem));
nsprop |= zfs_is_namespace_prop(prop);
assert(cl_idx < nvl_len); assert(cl_idx < nvl_len);
/* /*
@ -1934,8 +1936,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
* if one of the options handled by the generic * if one of the options handled by the generic
* Linux namespace layer has been modified. * Linux namespace layer has been modified.
*/ */
if (zfs_is_namespace_prop(prop) && if (nsprop && zfs_is_mounted(zhp, NULL))
zfs_is_mounted(zhp, NULL))
ret = zfs_mount(zhp, MNTOPT_REMOUNT, 0); ret = zfs_mount(zhp, MNTOPT_REMOUNT, 0);
} }
} }