* + mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch added to -mm tree
@ 2022-03-09 22:07 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-03-09 22:07 UTC (permalink / raw)
To: mm-commits, mtosatti, joaodias, cgoldswo, minchan, akpm
The patch titled
Subject: mm: fs: fix lru_cache_disabled race in bh_lru
has been added to the -mm tree. Its filename is
mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Minchan Kim <minchan@kernel.org>
Subject: mm: fs: fix lru_cache_disabled race in bh_lru
Check lru_cache_disabled under bh_lru_lock. Otherwise, it could introduce
race below and it fails to migrate pages containing buffer_head.
CPU 0 CPU 1
bh_lru_install
lru_cache_disable
lru_cache_disabled = false
atomic_inc(&lru_disable_count);
invalidate_bh_lrus_cpu of CPU 0
bh_lru_lock
__invalidate_bh_lrus
bh_lru_unlock
bh_lru_lock
install the bh
bh_lru_unlock
Link: https://lkml.kernel.org/r/20220308180709.2017638-1-minchan@kernel.org
Fixes: 8cc621d2f45d ("mm: fs: invalidate BH LRU during page migration")
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: John Dias <joaodias@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/buffer.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/fs/buffer.c~mm-fs-fix-lru_cache_disabled-race-in-bh_lru
+++ a/fs/buffer.c
@@ -1235,16 +1235,18 @@ static void bh_lru_install(struct buffer
int i;
check_irqs_on();
+ bh_lru_lock();
+
/*
* the refcount of buffer_head in bh_lru prevents dropping the
* attached page(i.e., try_to_free_buffers) so it could cause
* failing page migration.
* Skip putting upcoming bh into bh_lru until migration is done.
*/
- if (lru_cache_disabled())
+ if (lru_cache_disabled()) {
+ bh_lru_unlock();
return;
-
- bh_lru_lock();
+ }
b = this_cpu_ptr(&bh_lrus);
for (i = 0; i < BH_LRU_SIZE; i++) {
_
Patches currently in -mm which might be from minchan@kernel.org are
mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-09 22:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 22:07 + mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch added to -mm tree Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).