]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/sbitmap: define swap_lock as raw_spinlock_t
authorMing Lei <ming.lei@redhat.com>
Thu, 19 Sep 2024 02:17:09 +0000 (10:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:16 +0000 (16:33 +0200)
commit864df9264682f899aa577f767159c7c675b7fc4b
treeedf4eb8bbabfd93494afd9904b9e1045146bd9a2
parent81ed78937168854b9371b8d2cf293f1b3f3db5f3
lib/sbitmap: define swap_lock as raw_spinlock_t

[ Upstream commit 65f666c6203600053478ce8e34a1db269a8701c9 ]

When called from sbitmap_queue_get(), sbitmap_deferred_clear() may be run
with preempt disabled. In RT kernel, spin_lock() can sleep, then warning
of "BUG: sleeping function called from invalid context" can be triggered.

Fix it by replacing it with raw_spin_lock.

Cc: Yang Yang <yang.yang@vivo.com>
Fixes: 72d04bdcf3f7 ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Yang Yang <yang.yang@vivo.com>
Link: https://lore.kernel.org/r/20240919021709.511329-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/sbitmap.h
lib/sbitmap.c