On Thu, Jun 01 2023 at 3:28P -0400, Christoph Hellwig <hch@xxxxxx> wrote: > Currently callers can happily submit writes to block devices that are > marked read-only, including to drivers that don't even support writes > and will crash when fed such bios. > > While bio submitter should check for read-only devices, that's not a > very robust way of dealing with this. > > Note that the last attempt to do this got reverted by Linus in commit > a32e236eb93e ("Partially revert "block: fail op_is_write() requests to > read-only partitions") because device mapper relyied on not enforcing > the read-only state when used together with older lvm-tools. > > The lvm side got fixed in: > > https://sourceware.org/git/?p=lvm2.git;a=commit;h=a6fdb9d9d70f51c49ad11a87ab4243344e6701a3 > > but if people still have older lvm2 tools in use we probably need > to find a workaround for this in device mapper rather than lacking > the core block layer checks. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>