Re: memory hotplug and force_remove

From: Michal Hocko
Date: Fri Mar 31 2017 - 06:55:12 EST


On Fri 31-03-17 18:49:05, Joey Lee wrote:
> Hi Michal,
>
> On Fri, Mar 31, 2017 at 10:30:17AM +0200, Michal Hocko wrote:
[...]
> > @@ -241,11 +232,10 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
> > acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
> > NULL, acpi_bus_offline, (void *)true,
> > (void **)&errdev);
> > - if (!errdev || acpi_force_hot_remove)
> > + if (!errdev)
> > acpi_bus_offline(handle, 0, (void *)true,
> > (void **)&errdev);
> > -
> > - if (errdev && !acpi_force_hot_remove) {
> > + else {
> ^^^^^^^^^^^^^
> Here should still checks the parent's errdev state then rollback
> parent/children to online state:
>
> - if (errdev && !acpi_force_hot_remove) {
> + if (errdev) {

You are right, I have missed that acpi_bus_offline modifies errdev.
Thanks for spotting that! Updated patch is below.
---