From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Matthew Wilcox <willy@infradead.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 14:29:23 +0200 [thread overview]
Message-ID: <YNxjoxBNdWm604FU@kroah.com> (raw)
In-Reply-To: <YNxVAZDttnWncNUy@casper.infradead.org>
On Wed, Jun 30, 2021 at 12:26:57PM +0100, Matthew Wilcox wrote:
> 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>
That's even better!
But if so, how is the above reported problem even a problem if no one is
using cleancache?
thanks,
greg k-h
next prev parent reply other threads:[~2021-06-30 12:29 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
2021-06-30 12:29 ` gregkh [this message]
2021-07-01 5:06 ` 권오훈
2021-07-01 5:58 ` gregkh
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=YNxjoxBNdWm604FU@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.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 \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.