From: 권오훈 <ohoono.kwon@samsung.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
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: Thu, 01 Jul 2021 14:06:44 +0900 [thread overview]
Message-ID: <20210701050644epcms1p5ceaf654fdabec4a126081f9edcbb3fff@epcms1p5> (raw)
In-Reply-To: <YNxjoxBNdWm604FU@kroah.com>
On Thu, Jul 1, 2021 at 02:06:45PM +0900, 권오훈 wrote:
> 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
>
Dear all.
We are using Cleancache APIs for our proprietary feature in Samsung.
As Wilcox mentioned, however, there is no cleancache backend in current kernel
mainline.
So if the race patch shall be accepted, then it seems unnecessary to patch
previous stable kernels.
Meanwhile, I personally think cleancache API still has potential to be a good
material when used with new arising technologies such as pmem or NVMe.
So I suggest to postpone removing cleancache for a while.
Thanks,
Ohhoon Kwon.
next prev parent reply other threads:[~2021-07-01 5:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p2>
2021-06-30 7:33 ` 권오훈
2021-06-30 8:13 ` gregkh
2021-06-30 11:26 ` Matthew Wilcox
2021-06-30 12:29 ` gregkh
[not found] ` <CGME20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p5>
2021-07-01 5:06 ` 권오훈 [this message]
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=20210701050644epcms1p5ceaf654fdabec4a126081f9edcbb3fff@epcms1p5 \
--to=ohoono.kwon@samsung.com \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox