]> git.baikalelectronics.ru Git - kernel.git/commit
mbcache: Avoid nesting of cache->c_list_lock under bit locks
authorJan Kara <jack@suse.cz>
Thu, 8 Sep 2022 09:10:32 +0000 (11:10 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 1 Oct 2022 03:46:52 +0000 (23:46 -0400)
commit3deead75376ce72041e7017246f5da966d91ab5d
tree9f74c60588d40038bb165729dc88ceb31629d056
parent0b79d151fac7fcc6f5db50092da4316251cab7c6
mbcache: Avoid nesting of cache->c_list_lock under bit locks

Commit 8996bd12f319 ("mbcache: automatically delete entries from cache
on freeing") started nesting cache->c_list_lock under the bit locks
protecting hash buckets of the mbcache hash table in
mb_cache_entry_create(). This causes problems for real-time kernels
because there spinlocks are sleeping locks while bitlocks stay atomic.
Luckily the nesting is easy to avoid by holding entry reference until
the entry is added to the LRU list. This makes sure we cannot race with
entry deletion.

Cc: stable@kernel.org
Fixes: 8996bd12f319 ("mbcache: automatically delete entries from cache on freeing")
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220908091032.10513-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/mbcache.c