On Fri, Jun 2, 2023 at 11:41 AM Christoph Hellwig <hch@xxxxxx> wrote: > > Except the whole make a thing readonly just for fun is the corner case. > DM does it, and we have a sysfs file to allow it. But the usual > case is that a block device has been read-only all the time, or has > been force to be read-only by the actual storage device, which > doesn't know anything about the file descriptor model, and will > not be happy. The "it's always been read-only" case is unambiguous. So I do wonder if we should have two read-only bits: a "hard" and "soft" bit, and make the open-time one the hard bit. Anyway, I'm ok trying this simple thing once more, but if we end up getting reports of breakage again, I think you may just need to accept the fact that "somebody turned the device read-only after the fact" may just be something the kernel will have to continue to deal with. We might be able to squirrell the "read-only at time of open" bit away in the file descriptor in the FMODE_CAN_WRITE bit or something like that (although that would gives the wrong error for write(): -EINVAL instead of -EROFS or whatever) Linus -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel