diff options
author | Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> | 2021-10-29 19:39:26 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-29 06:55:39 -0600 |
commit | 15dfc662ef31a20b59097d59b0792b06770255fa (patch) | |
tree | c4fb2256304cbcc5b9af312e730b0f1066e9142a /arch/xtensa | |
parent | df75db1fc1e5608271397de37cab43371bb838d2 (diff) | |
download | linux-15dfc662ef31a20b59097d59b0792b06770255fa.tar.bz2 |
null_blk: Fix handling of submit_queues and poll_queues attributes
Commit 0a593fbbc245 ("null_blk: poll queue support") introduced the poll
queue feature to null_blk. After this change, null_blk device has both
submit queues and poll queues, and null_map_queues() callback maps the
both queues for corresponding hardware contexts. The commit also added
the device configuration attribute 'poll_queues' in same manner as the
existing attribute 'submit_queues'. These attributes allow to modify the
numbers of queues. However, when the new values are stored to these
attributes, the values are just handled only for the corresponding
queue. When number of submit_queue is updated, number of poll_queue is
not counted, or vice versa. This caused inconsistent number of queues
and queue mapping and resulted in null-ptr-dereference. This failure was
observed in blktests block/029 and block/030.
To avoid the inconsistency, fix the attribute updates to care both
submit_queues and poll_queues. Introduce the helper function
nullb_update_nr_hw_queues() to handle stores to the both two attributes.
Add poll_queues field to the struct nullb_device to track the number in
same manner as submit_queues. Add two more fields prev_submit_queues and
prev_poll_queues to keep the previous values before change. In case the
block layer failed to update the nr_hw_queues, refer the previous values
in null_map_queues() to map queues in same manner as before change.
Also add poll_queues value checks in nullb_update_nr_hw_queues() and
null_validate_conf(). They ensure the poll_queues value of each device
is within the range from 1 to module parameter value of poll_queues.
Fixes: 0a593fbbc245 ("null_blk: poll queue support")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20211029103926.845635-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'arch/xtensa')
0 files changed, 0 insertions, 0 deletions