]> git.baikalelectronics.ru Git - kernel.git/commit
brd: check for REQ_NOWAIT and set correct page allocation mask
authorJens Axboe <axboe@kernel.dk>
Thu, 16 Feb 2023 15:01:08 +0000 (08:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:15 +0000 (09:34 +0100)
commit50112938c76fe867fa38c0f3715f5b0d3b238f13
tree7acdda3e06af224794e8211a1a1047e6ae714ee7
parent32ab7f166a8da339c613112b9013a46a79191169
brd: check for REQ_NOWAIT and set correct page allocation mask

commit 4ea0edf5f936a015a533b5a4c58db936e927fcdd upstream.

If REQ_NOWAIT is set, then do a non-blocking allocation if the operation
is a write and we need to insert a new page. Currently REQ_NOWAIT cannot
be set as the queue isn't marked as supporting nowait, this change is in
preparation for allowing that.

radix_tree_preload() warns on attempting to call it with an allocation
mask that doesn't allow blocking. While that warning could arguably
be removed, we need to handle radix insertion failures anyway as they
are more likely if we cannot block to get memory.

Remove legacy BUG_ON()'s and turn them into proper errors instead, one
for the allocation failure and one for finding a page that doesn't
match the correct index.

Cc: stable@vger.kernel.org # 5.10+
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/brd.c