Commit dbc635c
ublk: move ublk_mark_io_ready() out of __ublk_fetch()
ublk_batch_prep_io() calls __ublk_fetch() while holding io->lock
spinlock. When the last IO makes the device ready, ublk_mark_io_ready()
tries to acquire ub->cancel_mutex which can sleep, causing a
sleeping-while-atomic bug.
Fix by moving ublk_mark_io_ready() out of __ublk_fetch() and into the
callers (ublk_fetch and ublk_batch_prep_io) after the spinlock is
released.
Reported-by: Jens Axboe <[email protected]>
Fixes: b256795 ("ublk: handle UBLK_U_IO_PREP_IO_CMDS")
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>1 parent e8cd481 commit dbc635c
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3064 | 3064 | | |
3065 | 3065 | | |
3066 | 3066 | | |
3067 | | - | |
3068 | 3067 | | |
3069 | 3068 | | |
3070 | 3069 | | |
| |||
3083 | 3082 | | |
3084 | 3083 | | |
3085 | 3084 | | |
| 3085 | + | |
| 3086 | + | |
3086 | 3087 | | |
3087 | 3088 | | |
3088 | 3089 | | |
| |||
3484 | 3485 | | |
3485 | 3486 | | |
3486 | 3487 | | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
3487 | 3491 | | |
3488 | 3492 | | |
3489 | 3493 | | |
| |||
0 commit comments