Commit a0b31735 authored by Jan Kara's avatar Jan Kara Committed by zhaoxiaoqiang11
Browse files

mbcache: Avoid nesting of cache->c_list_lock under bit locks

stable inclusion
from stable-v5.10.163
commit da20f56a3532d7f407a6c7028d795381cdcff14e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7PJ9N

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=da20f56a3532d7f407a6c7028d795381cdcff14e



----------------------------------------------------

commit 5fc4cbd9 upstream.

Commit 307af6c8 ("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: 307af6c8 ("mbcache: automatically delete entries from cache on freeing")
Reported-by: default avatarMike Galbraith <efault@gmx.de>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220908091032.10513-1-jack@suse.cz


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
parent 684b292b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment