diff mbox series

nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff

Message ID 20210330175126.26500-1-rppt@kernel.org (mailing list archive)
State New, archived
Headers show
Series nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff | expand

Commit Message

Mike Rapoport March 30, 2021, 5:51 p.m. UTC
From: Mike Rapoport <rppt@linux.ibm.com>

Commit cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
updated flush_dcache_page implementations on several architectures to use
page_mapping_file() in order to avoid races between page_mapping() and
swapoff().

This update missed arch/nds32 and there is a possibility of a race there.

Replace page_mapping() with page_mapping_file() in nds32 implementation of
flush_dcache_page().

Fixes: cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/nds32/mm/cacheflush.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Wilcox (Oracle) March 30, 2021, 6:13 p.m. UTC | #1
On Tue, Mar 30, 2021 at 08:51:26PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> Commit cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> updated flush_dcache_page implementations on several architectures to use
> page_mapping_file() in order to avoid races between page_mapping() and
> swapoff().
> 
> This update missed arch/nds32 and there is a possibility of a race there.
> 
> Replace page_mapping() with page_mapping_file() in nds32 implementation of
> flush_dcache_page().
> 
> Fixes: cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Greentime Hu March 31, 2021, 7:30 a.m. UTC | #2
Matthew Wilcox <willy@infradead.org> 於 2021年3月31日 週三 上午2:14寫道:
>
> On Tue, Mar 30, 2021 at 08:51:26PM +0300, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> >
> > Commit cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> > updated flush_dcache_page implementations on several architectures to use
> > page_mapping_file() in order to avoid races between page_mapping() and
> > swapoff().
> >
> > This update missed arch/nds32 and there is a possibility of a race there.
> >
> > Replace page_mapping() with page_mapping_file() in nds32 implementation of
> > flush_dcache_page().
> >
> > Fixes: cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Greentiime Hu <green.hu@gmail.com>
Greentime Hu March 31, 2021, 7:30 a.m. UTC | #3
Greentime Hu <green.hu@gmail.com> 於 2021年3月31日 週三 下午3:30寫道:
>
> Matthew Wilcox <willy@infradead.org> 於 2021年3月31日 週三 上午2:14寫道:
> >
> > On Tue, Mar 30, 2021 at 08:51:26PM +0300, Mike Rapoport wrote:
> > > From: Mike Rapoport <rppt@linux.ibm.com>
> > >
> > > Commit cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> > > updated flush_dcache_page implementations on several architectures to use
> > > page_mapping_file() in order to avoid races between page_mapping() and
> > > swapoff().
> > >
> > > This update missed arch/nds32 and there is a possibility of a race there.
> > >
> > > Replace page_mapping() with page_mapping_file() in nds32 implementation of
> > > flush_dcache_page().
> > >
> > > Fixes: cb9f753a3731 ("mm: fix races between swapoff and flush dcache")
> > > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> >
> > Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> Acked-by: Greentiime Hu <green.hu@gmail.com>
Typo.
Acked-by: Greentime Hu <green.hu@gmail.com>
diff mbox series

Patch

diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
index 6eb98a7ad27d..ad5344ef5d33 100644
--- a/arch/nds32/mm/cacheflush.c
+++ b/arch/nds32/mm/cacheflush.c
@@ -238,7 +238,7 @@  void flush_dcache_page(struct page *page)
 {
 	struct address_space *mapping;
 
-	mapping = page_mapping(page);
+	mapping = page_mapping_file(page);
 	if (mapping && !mapping_mapped(mapping))
 		set_bit(PG_dcache_dirty, &page->flags);
 	else {