On 05/11/2025 18:22, Mikulas Patocka wrote:
Sure, but the good news is that we have checks in the block stack for this,
i.e. if dm submits a bio with REQ_ATOMIC to a device which doesn't support
atomic writes, then the block stack will reject it. The physical device will
also reject it.
Yes - but the block layer checks the bio without preventing device mapper
table swap.
So, the block layer may find out that a device supports atomic writes,
pass the bio through to dm, dm table may be reloaded and the bio would be
sent to a target that doesn't expect it.
ok, I think that I understand... So if this occurs, I think that when
the cloned bio is submitted to the target bdev, the block bio submission
path may find that the target bdev does not support atomic writes and
reject the bio, see REQ_ATOMIC check in submit_bio_noacct().
You must do the check inside the RCU read region to make sure that the
dm table can't be swapped underneath.
Right
Thanks,
John