diff options
author | John Garry <john.g.garry@oracle.com> | 2025-01-16 20:02:57 +0300 |
---|---|---|
committer | Mikulas Patocka <mpatocka@redhat.com> | 2025-01-18 00:24:01 +0300 |
commit | 5f430e34087b4882545baa3d31962f1f7d735421 (patch) | |
tree | ba85d3924db2a44e972b86251c62621c8d75c592 | |
parent | 3194e36488e2dae05f9a822c73eaa367e47b2e3d (diff) | |
download | linux-5f430e34087b4882545baa3d31962f1f7d735421.tar.xz |
dm: Ensure cloned bio is same length for atomic write
For an atomic write, a cloned bio must be same length as the original bio,
i.e. no splitting.
Error in case it is not.
Per-dm device queue limits should be setup to ensure that this does not
happen, but error this case as an insurance policy.
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-rw-r--r-- | drivers/md/dm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index ee86cc60d4b8..4d1e42891d24 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1745,6 +1745,9 @@ static blk_status_t __split_and_process_bio(struct clone_info *ci) ci->submit_as_polled = !!(ci->bio->bi_opf & REQ_POLLED); len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count); + if (ci->bio->bi_opf & REQ_ATOMIC && len != ci->sector_count) + return BLK_STS_IOERR; + setup_split_accounting(ci, len); if (unlikely(ci->bio->bi_opf & REQ_NOWAIT)) { |