zvol readonly don't take effect until ctld is restarted
Description
Problem/Justification
Impact
Activity
Bug Clerk December 14, 2023 at 9:45 PM
Automation for Jira December 13, 2023 at 10:15 PM
This issue has now been closed. Comments made after this point may not be viewed by the TrueNAS Teams. Please open a new issue if you have found a problem or need to re-engage with the TrueNAS Engineering Teams.
Bug Clerk December 13, 2023 at 3:57 PM
Ameer Hamza December 11, 2023 at 7:34 PM
I have confirmed that https://github.com/openzfs/zfs/pull/15409 fixes the issue on Core as well. The suspicions were raised earlier on https://github.com/openzfs/zfs/issues/15506 but later it was pointed out to some other commit. I am following up on the same issue and will try to land it in the next zfs-2.2 release.
Alexander Motin December 4, 2023 at 4:38 PMEdited
It is a known issues, that we’ve already addressed upstream in https://github.com/openzfs/zfs/pull/15409 . Unfortunately something looked suspicious there and so it was not included into ZFS 2.2.1 release. @Ameer Hamza We need another look on it.
Customer contacted us to say that they set a zvol readonly but are still able to write to it. We have reproduced the issue in-house and also found that the inverse is true: a readonly zvol won't become writeable until ctld is restarted.
Is this desired behavior?
Steps to reproduce scenario #1:
create zvol
share zvol via iSCSI
set zvol readonly=on
you can still write to the zvol until ctld is restarted
root@beater[~]# dd if=/dev/urandom of=/dev/zvol/tank/zoolander bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 6.286884 secs (166787865 bytes/sec) root@beater[~]# zfs get readonly tank/zoolander NAME PROPERTY VALUE SOURCE tank/zoolander readonly on local root@beater[~]# dd if=/dev/urandom of=/dev/zvol/tank/zoolander bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 6.621453 secs (158360411 bytes/sec) root@beater[~]# ls -l /dev/zvol/tank/zoolander crw-r----- 1 root operator 0xb0 Nov 30 16:48 /dev/zvol/tank/zoolander root@beater[~]# service ctld restart Stopping ctld. Starting ctld. root@beater[~]# dd if=/dev/urandom of=/dev/zvol/tank/zoolander bs=1M count=1000 dd: /dev/zvol/tank/zoolander: Read-only file system root@beater[~]#
Steps to reproduce scenario #2:
create zvol
set zvol readonly
share zvol in iSCSI
set zvol readonly=off
you can't write to the zvol until ctld is restarted
root@beater[~]# zfs get readonly tank/zoolander NAME PROPERTY VALUE SOURCE tank/zoolander readonly on local ### zvol was then set readonly=off in the WebUI ### root@beater[~]# zfs get readonly tank/zoolander NAME PROPERTY VALUE SOURCE tank/zoolander readonly off local root@beater[~]# dd if=/dev/urandom of=/dev/zvol/tank/zoolander bs=1M count=10 dd: /dev/zvol/tank/zoolander: Read-only file system root@beater[~]# service ctld restart Stopping ctld. Starting ctld. root@beater[~]# dd if=/dev/urandom of=/dev/zvol/tank/zoolander bs=1M count=10 10+0 records in 10+0 records out 10485760 bytes transferred in 0.045205 secs (231960438 bytes/sec) root@beater[~]#