Skip to content
Commit cf785af1 authored by Eric Biggers's avatar Eric Biggers Committed by Jens Axboe
Browse files

block: warn if !__GFP_DIRECT_RECLAIM in bio_crypt_set_ctx()



bio_crypt_set_ctx() assumes its gfp_mask argument always includes
__GFP_DIRECT_RECLAIM, so that the mempool_alloc() will always succeed.

For now this assumption is still fine, since no callers violate it.
Making bio_crypt_set_ctx() able to fail would add unneeded complexity.

However, if a caller didn't use __GFP_DIRECT_RECLAIM, it would be very
hard to notice the bug.  Make it easier by adding a WARN_ON_ONCE().

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarSatya Tangirala <satyat@google.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Satya Tangirala <satyat@google.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 93f221ae
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment