|
| 1 | +dm: fix improper splitting for abnormal bios |
| 2 | + |
| 3 | +jira LE-1907 |
| 4 | +Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 |
| 5 | +commit-author Mike Snitzer < [email protected]> |
| 6 | +commit f7b58a69fad9d2c4c90cab0247811155dd0d48e7 |
| 7 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 8 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 9 | +ciq/ciq_backports/kernel-rt-5.14.0-284.30.1.rt14.315.el9_2/f7b58a69.failed |
| 10 | + |
| 11 | +"Abnormal" bios include discards, write zeroes and secure erase. By no |
| 12 | +longer passing the calculated 'len' pointer, commit 7dd06a2548b2 ("dm: |
| 13 | +allow dm_accept_partial_bio() for dm_io without duplicate bios") took a |
| 14 | +senseless approach to disallowing dm_accept_partial_bio() from working |
| 15 | +for duplicate bios processed using __send_duplicate_bios(). |
| 16 | + |
| 17 | +It inadvertently and incorrectly stopped the use of 'len' when |
| 18 | +initializing a target's io (in alloc_tio). As such the resulting tio |
| 19 | +could address more area of a device than it should. |
| 20 | + |
| 21 | +For example, when discarding an entire DM striped device with the |
| 22 | +following DM table: |
| 23 | + vg-lvol0: 0 159744 striped 2 128 7:0 2048 7:1 2048 |
| 24 | + vg-lvol0: 159744 45056 striped 2 128 7:2 2048 7:3 2048 |
| 25 | + |
| 26 | +Before this fix: |
| 27 | + |
| 28 | + device-mapper: striped: target_stripe=0, bdev=7:0, start=2048 len=102400 |
| 29 | + blkdiscard: attempt to access beyond end of device |
| 30 | + loop0: rw=2051, sector=2048, nr_sectors = 102400 limit=81920 |
| 31 | + |
| 32 | + device-mapper: striped: target_stripe=1, bdev=7:1, start=2048 len=102400 |
| 33 | + blkdiscard: attempt to access beyond end of device |
| 34 | + loop1: rw=2051, sector=2048, nr_sectors = 102400 limit=81920 |
| 35 | + |
| 36 | +After this fix; |
| 37 | + |
| 38 | + device-mapper: striped: target_stripe=0, bdev=7:0, start=2048 len=79872 |
| 39 | + device-mapper: striped: target_stripe=1, bdev=7:1, start=2048 len=79872 |
| 40 | + |
| 41 | +Fixes: 7dd06a2548b2 ("dm: allow dm_accept_partial_bio() for dm_io without duplicate bios") |
| 42 | + |
| 43 | + Reported-by: Orange Kao < [email protected]> |
| 44 | + Signed-off-by: Mike Snitzer < [email protected]> |
| 45 | +(cherry picked from commit f7b58a69fad9d2c4c90cab0247811155dd0d48e7) |
| 46 | + Signed-off-by: Jonathan Maple < [email protected]> |
| 47 | + |
| 48 | +# Conflicts: |
| 49 | +# drivers/md/dm.c |
| 50 | +diff --cc drivers/md/dm.c |
| 51 | +index a84025b34305,e67a2757c53e..000000000000 |
| 52 | +--- a/drivers/md/dm.c |
| 53 | ++++ b/drivers/md/dm.c |
| 54 | +@@@ -1524,7 -1467,8 +1524,12 @@@ static void setup_split_accounting(stru |
| 55 | + } |
| 56 | + |
| 57 | + static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci, |
| 58 | +++<<<<<<< HEAD |
| 59 | + + struct dm_target *ti, unsigned num_bios) |
| 60 | +++======= |
| 61 | ++ struct dm_target *ti, unsigned int num_bios, |
| 62 | ++ unsigned *len) |
| 63 | +++>>>>>>> f7b58a69fad9 (dm: fix improper splitting for abnormal bios) |
| 64 | + { |
| 65 | + struct bio *bio; |
| 66 | + int try; |
| 67 | +* Unmerged path drivers/md/dm.c |
0 commit comments