]> git.proxmox.com Git - mirror_zfs.git/commitdiff
libzfs: refresh property cache after inheriting userprop
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Fri, 16 Apr 2021 18:03:20 +0000 (20:03 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 17 Apr 2021 19:39:54 +0000 (12:39 -0700)
This matches what happens when inheriting a system property

Consider the following program:
int main() {
void *zhp = libzfs_init();
void *dataset = zfs_open(zhp, "zest/__test", 1);

printf("before:");
dump_nvlist(zfs_get_user_props(dataset), 2);
printf("\n");

zfs_prop_inherit(dataset, "xyz.nabijaczleweli:test", 0);
printf("after:");
dump_nvlist(zfs_get_user_props(dataset), 2);
printf("\n");

zfs_refresh_properties(dataset);
printf("refreshed:");
dump_nvlist(zfs_get_user_props(dataset), 2);
printf("\n");
}

And the output before:
# zfs set xyz.nabijaczleweli:test=hehe zest/__test
# ./a.out
before:  xyz.nabijaczleweli:test:
      value: 'hehe'
      source: 'zest/__test'

after:  xyz.nabijaczleweli:test:
      value: 'hehe'
      source: 'zest/__test'

refreshed:

As compared to the output after:
# zfs set xyz.nabijaczleweli:test=hehe zest/__test
# ./a.out
before:  xyz.nabijaczleweli:test:
      value: 'hehe'
      source: 'zest/__test'

after:
refreshed:

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11064
Closes #11911

lib/libzfs/libzfs_dataset.c

index 423050e045d02cbc9d2c9c9b9b3b86bcaa02d3f9..823fcb284d2e5d68f48580d8b07b542d286c2b3b 100644 (file)
@@ -1953,6 +1953,7 @@ zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received)
                if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_INHERIT_PROP, &zc) != 0)
                        return (zfs_standard_error(hdl, errno, errbuf));
 
+               (void) get_stats(zhp);
                return (0);
        }