Commit 49d2439
blk-mq: enforce op-specific segment limits in blk_insert_cloned_request
The block layer might merge together discard requests up until the
max_discard_segments limit is hit, but blk_insert_cloned_request checks
the segment count against max_segments regardless of the req op. This
can result in errors like the following when discards are issued through
a DM device and max_discard_segments exceeds max_segments for the queue
of the chosen underlying device.
blk_insert_cloned_request: over max segments limit. (256 > 129)
Fix this by looking at the req_op and enforcing the appropriate segment
limit - max_discard_segments for REQ_OP_DISCARDs and max_segments for
everything else.
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230301000655.48112-1-ushankar@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 326ac2c commit 49d2439
3 files changed
+11
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | 589 | | |
597 | 590 | | |
598 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3000 | 3000 | | |
3001 | 3001 | | |
3002 | 3002 | | |
| 3003 | + | |
3003 | 3004 | | |
3004 | 3005 | | |
3005 | 3006 | | |
| |||
3026 | 3027 | | |
3027 | 3028 | | |
3028 | 3029 | | |
3029 | | - | |
3030 | | - | |
3031 | | - | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
3032 | 3033 | | |
3033 | 3034 | | |
3034 | 3035 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
| |||
0 commit comments