[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNwnqOuFlIG6Jofy@kroah.com>
Date: Wed, 30 Jun 2021 10:13:28 +0200
From: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
To: 권오훈 <ohoono.kwon@...sung.com>
Cc: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"konrad.wilk@...cle.com" <konrad.wilk@...cle.com>,
"ohkwon1043@...il.com" <ohkwon1043@...il.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: cleancache: fix potential race in cleancache apis
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@...sung.com>
What commit does this fix? Should it go to stable kernels?
thanks,
greg k-h
Powered by blists - more mailing lists