ZFS ZFS inheritance of readonly attribute behaves weirdly

I am testing on an updated 13.2-RELEASE-p3.

I am observing some weird behavior related to inheriting the readonly dataset attribute when creating or cloning datasets.
This behavior is exhibited whenever the parent dataset has SOURCE=default of the property.

Consider the following log:
Bash:
root@mbvm03 /tmp # zfs get readonly zroot/tmp
NAME       PROPERTY  VALUE   SOURCE
zroot/tmp  readonly  off     default
root@mbvm03 /tmp # zfs destroy -r zroot/tmp/deleteme
root@mbvm03 /tmp # zfs create -p -o mountpoint=/tmp/deleteme zroot/tmp/deleteme
root@mbvm03 /tmp # zfs create -p zroot/tmp/deleteme/kid/grandkid
root@mbvm03 /tmp # zfs set readonly=on zroot/tmp/deleteme
root@mbvm03 /tmp # zfs inherit readonly zroot/tmp/deleteme/kid/grandkid
root@mbvm03 /tmp # zfs get -r readonly zroot/tmp/deleteme
NAME                             PROPERTY  VALUE   SOURCE
zroot/tmp/deleteme               readonly  on      local
zroot/tmp/deleteme/kid           readonly  off     temporary
zroot/tmp/deleteme/kid/grandkid  readonly  on      inherited from zroot/tmp/deleteme

I have created the dataset zroot/tmp/deleteme while setting a mountpoint, then the kid ends up having readonly=off, although the grandkid successfully inherits the value readonly=on from zroot/tmp/deleteme.

But see what happens whenever I run the same commands without setting a mountpoint:
Bash:
root@mbvm03 /tmp # zfs destroy -r zroot/tmp/deleteme
root@mbvm03 /tmp # zfs create -p zroot/tmp/deleteme
root@mbvm03 /tmp # zfs create -p zroot/tmp/deleteme/kid/grandkid
root@mbvm03 /tmp # zfs set readonly=on zroot/tmp/deleteme
root@mbvm03 /tmp # zfs inherit readonly zroot/tmp/deleteme/kid/grandkid
root@mbvm03 /tmp # zfs get -r readonly zroot/tmp/deleteme
NAME                             PROPERTY  VALUE   SOURCE
zroot/tmp/deleteme               readonly  on      local
zroot/tmp/deleteme/kid           readonly  on      inherited from zroot/tmp/deleteme
zroot/tmp/deleteme/kid/grandkid  readonly  on      inherited from zroot/tmp/deleteme

We see that the kid now has a different value readonly=on. The grandkid again inherits the value successfully from zroot/tmp/deleteme.

Two questions to the ZFS experts:
  1. How come setting a mountpoint for one of the intermediate datasets has an impact on whether its kids inherit readonly successfully or not??
  2. In the first case, how is it possible that the inheritance skips a level and the kid has a non-inherited value, but the grandkid inherits properly?
 
Update: When testing on an older box with 13.0-RELEASE-p5 the behavior is different (as expected). Here is the output in both cases:
Code:
NAME                             PROPERTY  VALUE   SOURCE
zroot/tmp/deleteme               readonly  on      local
zroot/tmp/deleteme/kid           readonly  on      inherited from zroot/tmp/deleteme
zroot/tmp/deleteme/kid/grandkid  readonly  on      inherited from zroot/tmp/deleteme

# ...
NAME                             PROPERTY  VALUE   SOURCE
zroot/tmp/deleteme               readonly  on      local
zroot/tmp/deleteme/kid           readonly  on      inherited from zroot/tmp/deleteme
zroot/tmp/deleteme/kid/grandkid  readonly  on      inherited from zroot/tmp/deleteme
 
Back
Top