linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
@ 2021-03-30 17:51 Mike Rapoport
  2021-03-30 18:13 ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Rapoport @ 2021-03-30 17:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greentime Hu, Huang Ying, Matthew Wilcox, Mike Rapoport,
	Mike Rapoport, Nick Hu, Vincent Chen, linux-kernel, linux-mm

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(-)

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 {
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
  2021-03-30 17:51 [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff Mike Rapoport
@ 2021-03-30 18:13 ` Matthew Wilcox
  2021-03-31  7:30   ` Greentime Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2021-03-30 18:13 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Andrew Morton, Greentime Hu, Huang Ying, Mike Rapoport, Nick Hu,
	Vincent Chen, linux-kernel, linux-mm

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
  2021-03-30 18:13 ` Matthew Wilcox
@ 2021-03-31  7:30   ` Greentime Hu
  2021-03-31  7:30     ` Greentime Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Greentime Hu @ 2021-03-31  7:30 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Mike Rapoport, Andrew Morton, Huang Ying, Mike Rapoport, Nick Hu,
	Vincent Chen, Linux Kernel Mailing List,
	Linux Memory Management List

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
  2021-03-31  7:30   ` Greentime Hu
@ 2021-03-31  7:30     ` Greentime Hu
  0 siblings, 0 replies; 4+ messages in thread
From: Greentime Hu @ 2021-03-31  7:30 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Mike Rapoport, Andrew Morton, Huang Ying, Mike Rapoport, Nick Hu,
	Vincent Chen, Linux Kernel Mailing List,
	Linux Memory Management List

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-31  7:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 17:51 [PATCH] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff Mike Rapoport
2021-03-30 18:13 ` Matthew Wilcox
2021-03-31  7:30   ` Greentime Hu
2021-03-31  7:30     ` Greentime Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).