On Thu, Jun 01 2023 at 3:28P -0400,
Christoph Hellwig 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
On Fri, Jun 2, 2023 at 11:41 AM Christoph Hellwig 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
[quoting your reply out of order, because I think it makes sense that
way]
On Thu, Jun 01, 2023 at 09:02:25PM -0400, Linus Torvalds wrote:
> So honestly, that whole test for
>
> + if (op_is_write(bio_op(bio)) && bio_sectors(bio) &&
> + bdev_read_only(bdev)) {
>
> may look
On Thu, Jun 1, 2023 at 3:28 AM Christoph Hellwig wrote:
>
> 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
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