Commit 53f2bca
block/null_blk: Fix double blk_mq_start_request() warning
When CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION is enabled, null_queue_rq()
would return BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE for the request,
which has been marked as MQ_RQ_IN_FLIGHT by blk_mq_start_request().
Then null_queue_rqs() put these requests in the rqlist, return back to
the block layer core, which would try to queue them individually again,
so the warning in blk_mq_start_request() triggered.
Fix it by splitting the null_queue_rq() into two parts: the first is the
preparation of request, the second is the handling of request. We put
the blk_mq_start_request() after the preparation part, which may fail
and return back to the block layer core.
The throttling also belongs to the preparation part, so move it before
blk_mq_start_request(). And change the return type of null_handle_cmd()
to void, since it always return BLK_STS_OK now.
Reported-by: <syzbot+fcc47ba2476570cbbeb0@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/0000000000000e6aac06098aee0c@google.com/
Fixes: d78bfa1 ("block/null_blk: add queue_rqs() support")
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Link: https://lore.kernel.org/r/20231120032521.1012037-1-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent c96b817 commit 53f2bca
1 file changed
Lines changed: 13 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
1467 | | - | |
1468 | | - | |
| 1467 | + | |
| 1468 | + | |
1469 | 1469 | | |
1470 | 1470 | | |
1471 | 1471 | | |
1472 | 1472 | | |
1473 | 1473 | | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | 1474 | | |
1481 | 1475 | | |
1482 | 1476 | | |
| |||
1493 | 1487 | | |
1494 | 1488 | | |
1495 | 1489 | | |
1496 | | - | |
1497 | 1490 | | |
1498 | 1491 | | |
1499 | 1492 | | |
| |||
1724 | 1717 | | |
1725 | 1718 | | |
1726 | 1719 | | |
1727 | | - | |
1728 | | - | |
1729 | 1720 | | |
1730 | 1721 | | |
1731 | 1722 | | |
| |||
1738 | 1729 | | |
1739 | 1730 | | |
1740 | 1731 | | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1741 | 1741 | | |
1742 | 1742 | | |
1743 | 1743 | | |
| |||
1747 | 1747 | | |
1748 | 1748 | | |
1749 | 1749 | | |
1750 | | - | |
| 1750 | + | |
| 1751 | + | |
1751 | 1752 | | |
1752 | 1753 | | |
1753 | 1754 | | |
| |||
0 commit comments