diff options
author | Ming Lei <ming.lei@redhat.com> | 2024-09-19 05:17:09 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-09-20 09:20:06 +0300 |
commit | 65f666c6203600053478ce8e34a1db269a8701c9 (patch) | |
tree | 9be4a5edc10fbe06af0f9ea2b1c05abafec8a363 /include/linux/sbitmap.h | |
parent | 9ba5dcc722de4390a1d3211b2ee3c864f84f5461 (diff) | |
download | linux-65f666c6203600053478ce8e34a1db269a8701c9.tar.xz |
lib/sbitmap: define swap_lock as raw_spinlock_t
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>
Diffstat (limited to 'include/linux/sbitmap.h')
-rw-r--r-- | include/linux/sbitmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index c09cdcc99471..189140bf11fc 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -40,7 +40,7 @@ struct sbitmap_word { /** * @swap_lock: serializes simultaneous updates of ->word and ->cleared */ - spinlock_t swap_lock; + raw_spinlock_t swap_lock; } ____cacheline_aligned_in_smp; /** |