ZFS_READONLY is a little too strict
There was a misunderstanding about the enforcement details of the "Read-only" flag introduced for SMB/CIFS compatibility, way back in 2007 in the Sun PSARC 2007/315 case.
The original authors thought enforcement of the READONLY flag should work similarly as the IMMUTABLE flag. Unfortunately, that enforcement is incompatible with the expectations of Windows applications using this feature through the SMB service. Applications assume (and the MS File System Algorithms MS-FSA confirms they should) that an SMB client can:
(a) Open an SMB handle on a file with read/write access,
(b) Set the DOS attributes to include the READONLY flag,
(c) continue to have write access via that handle.
This access model is essentially the same as a Unix/POSIX application that creates a file (with read/write access), uses fchmod() to change the file mode to something not granting write access (i.e. 0444), and then continues to write that file using the open handle it got before the mode change.
Currently, the SMB server works-around this problem in a way that will become difficult to maintain as we implement support for SMB3 persistent handles, so SMB depends on this fix.
I've written a test program that can be used to demonstrate this problem, and added it to zfs-tests (tests/functional/acl/cifs/cifs_attr_004_pos).
It currently fails, but will pass when this problem fixed.
Steps to Reproduce:
Run the test program on a ZFS file system.
Updated by Electric Monk about 3 years ago
- % Done changed from 50 to 100
- Status changed from In Progress to Closed
commit 2889ec41c05e9ffe1890b529b3111354da325aeb Author: Gordon Ross <email@example.com> Date: 2017-06-14T04:28:05.000Z 8311 ZFS_READONLY is a little too strict Reviewed by: Sanjay Nadkarni <firstname.lastname@example.org> Reviewed by: Yuri Pankov <email@example.com> Reviewed by: Andrew Stormont <firstname.lastname@example.org> Reviewed by: Matt Ahrens <email@example.com> Reviewed by: John Kennedy <firstname.lastname@example.org> Approved by: Prakash Surya <email@example.com>