PM / reboot: Eliminate race between reboot and suspend
At present, "systemctl suspend" and "shutdown" can run in parrallel. A system can suspend after devices_shutdown(), and resume. Then the shutdown task goes on to power off. This causes many devices are not really shut off. Hence replacing reboot_mutex with system_transition_mutex (renamed from pm_mutex) to achieve the exclusion. The renaming of pm_mutex as system_transition_mutex can be better to reflect the purpose of the mutex. Signed-off-by: Pingfan Liu <kernelfans@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
82837ad5bd
commit
55f2503c3b
@@ -216,7 +216,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!mutex_trylock(&pm_mutex))
|
||||
if (!mutex_trylock(&system_transition_mutex))
|
||||
return -EBUSY;
|
||||
|
||||
lock_device_hotplug();
|
||||
@@ -394,7 +394,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
|
||||
}
|
||||
|
||||
unlock_device_hotplug();
|
||||
mutex_unlock(&pm_mutex);
|
||||
mutex_unlock(&system_transition_mutex);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user