From: Matthew Wilcox <willy@infradead.org>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: 권오훈 <ohoono.kwon@samsung.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"ohkwon1043@gmail.com" <ohkwon1043@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: cleancache: fix potential race in cleancache apis
Date: Wed, 30 Jun 2021 12:26:57 +0100 [thread overview]
Message-ID: <YNxVAZDttnWncNUy@casper.infradead.org> (raw)
In-Reply-To: <YNwnqOuFlIG6Jofy@kroah.com>
On Wed, Jun 30, 2021 at 10:13:28AM +0200, gregkh@linuxfoundation.org wrote:
> On Wed, Jun 30, 2021 at 04:33:10PM +0900, 권오훈 wrote:
> > Current cleancache api implementation has potential race as follows,
> > which might lead to corruption in filesystems using cleancache.
> >
> > thread 0 thread 1 thread 2
> >
> > in put_page
> > get pool_id K for fs1
> > invalidate_fs on fs1
> > frees pool_id K
> > init_fs for fs2
> > allocates pool_id K
> > put_page puts page
> > which belongs to fs1
> > into cleancache pool for fs2
> >
> > At this point, a file cache which originally belongs to fs1 might be
> > copied back to cleancache pool of fs2, which might be later used as if
> > it were normal cleancache of fs2, and could eventually corrupt fs2 when
> > flushed back.
> >
> > Add rwlock in order to synchronize invalidate_fs with other cleancache
> > operations.
> >
> > In normal situations where filesystems are not frequently mounted or
> > unmounted, there will be little performance impact since
> > read_lock/read_unlock apis are used.
> >
> > Signed-off-by: Ohhoon Kwon <ohoono.kwon@samsung.com>
>
> What commit does this fix? Should it go to stable kernels?
I have a commit I haven't submitted yet with this changelog:
Remove cleancache
The last cleancache backend was deleted in v5.3 ("xen: remove tmem
driver"), so it has been unused since. Remove all its filesystem hooks.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
next prev parent reply other threads:[~2021-06-30 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p2>
2021-06-30 7:33 ` [PATCH] mm: cleancache: fix potential race in cleancache apis 권오훈
2021-06-30 8:13 ` gregkh
2021-06-30 11:26 ` Matthew Wilcox [this message]
2021-06-30 12:29 ` gregkh
[not found] ` <CGME20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p5>
2021-07-01 5:06 ` 권오훈
2021-07-01 5:58 ` gregkh
[not found] ` <CGME20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p3>
2021-07-01 8:56 ` 권오훈
2021-07-01 11:57 ` Matthew Wilcox
2021-07-01 8:14 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YNxVAZDttnWncNUy@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ohkwon1043@gmail.com \
--cc=ohoono.kwon@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).