Re: [PATCH v3] mm/hwpoison: do not lock page again when me_huge_page() successfully recovers

From: Andrew Morton
Date: Mon Jun 14 2021 - 22:35:36 EST


On Fri, 11 Jun 2021 00:23:29 +0000 HORIGUCHI NAOYA(堀口 直也) <naoya.horiguchi@xxxxxxx> wrote:

> >
> > --- mm/memory-failure.c
> > +++ mm/memory-failure.c
> > @@ -1782,6 +1796,8 @@ int memory_failure(unsigned long pfn, int flags)
> >
> > identify_page_state:
> > res = identify_page_state(pfn, p, page_flags);
> > + mutex_unlock(&mf_mutex);
> > + return res;
> > unlock_page:
> > unlock_page(p);
> > unlock_mutex:
> >
> > and... That mutex_unlock() looks odd. The patch adds no matching
> > mutex_lock?
>
> Yes, memory_failure() already has one mutex_lock (introduced by
> mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races.patch,
> sorry for not clarifying that), and the change introduces a separate
> return path. But I now think that I should have used "goto unlock_mutex"
> to use existing return path.

But mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races.patch
is part of Tony's three patch series which is not marked for -stable.
So it isn't appropriate that this patch be based on top of that three
patch series.

Should Tony's patchset also be targeted to -stable? If so then OK.

If not then please let's prepare your -stable patch against current
mainline, as it is higher priority than the 5.14-rc1 material in
linux-next.