From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: 권오훈 <ohoono.kwon@samsung.com>
Cc: "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 10:13:28 +0200 [thread overview]
Message-ID: <YNwnqOuFlIG6Jofy@kroah.com> (raw)
In-Reply-To: <20210630073310epcms1p2ad6803cfd9dbc8ab501c4c99f799f4da@epcms1p2>
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?
thanks,
greg k-h
next prev parent reply other threads:[~2021-06-30 8:13 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 [this message]
2021-06-30 11:26 ` Matthew Wilcox
2021-06-30 12:29 ` gregkh
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=YNwnqOuFlIG6Jofy@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 \
/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