]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:59 +0000 (11:41 +0100)
commita15e86d51717907133562001b41c61115e06513d
tree5f8b3e71ef9b5a16619e907fd8f140f8707d46bb
parentb0ecf55417cbe0d9c6015e3fed1dc97aa7fac936
mbcache: Avoid nesting of cache->c_list_lock under bit locks

commit 4c05e90523b3bc645b17886f5c79adcc8e526f26 upstream.

Commit 07d57c4e53b4 ("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: 07d57c4e53b4 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/mbcache.c