The sysfs attribute `/sys/power/sync_on_suspend` controls, whether or not filesystems are synced by the kernel before system suspend. Congruously, the behaviour of build-time switch CONFIG_SUSPEND_SKIP_SYNC is slightly changed: It now defines the run-tim default for the new sysfs attribute `/sys/power/sync_on_suspend`. The run-time attribute is added because the existing corresponding build-time Kconfig flag for (`CONFIG_SUSPEND_SKIP_SYNC`) is not flexible enough. E.g. Linux distributions that provide pre-compiled kernels usually want to stick with the default (sync filesystems before suspend) but under special conditions this needs to be changed. One example for such a special condition is user-space handling of suspending block devices (e.g. using `cryptsetup luksSuspend` or `dmsetup suspend`) before system suspend. The Kernel trying to sync filesystems after the underlying block device already got suspended obviously leads to dead-locks. Be aware that you have to take care of the filesystem sync yourself before suspending the system in those scenarios.
Showing the changes to include/linux (1 of 5 files). Show all
Unified · Split
| @@ -329,6 +329,7 @@ extern void arch_suspend_disable_irqs(void); · 328 unmodified lines | |||
| 329 | extern void arch_suspend_enable_irqs(void); | 329 | extern void arch_suspend_enable_irqs(void); |
| 330 | 330 | ||
| 331 | extern int pm_suspend(suspend_state_t state); | 331 | extern int pm_suspend(suspend_state_t state); |
| 332 | extern bool sync_on_suspend_enabled; | ||
| 332 | #else /* !CONFIG_SUSPEND */ | 333 | #else /* !CONFIG_SUSPEND */ |
| 333 | #define suspend_valid_only_mem NULL | 334 | #define suspend_valid_only_mem NULL |
| 334 | 335 | ||
| @@ -342,6 +343,7 @@ static inline bool pm_suspend_default_s2idle(void) { return false; } · 7 unmodified lines | |||
| 342 | 343 | ||
| 343 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} | 344 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} |
| 344 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } | 345 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } |
| 346 | static inline bool sync_on_suspend_enabled(void) { return true; } | ||
| 345 | static inline bool idle_should_enter_s2idle(void) { return false; } | 347 | static inline bool idle_should_enter_s2idle(void) { return false; } |
| 346 | static inline void __init pm_states_init(void) {} | 348 | static inline void __init pm_states_init(void) {} |
| 347 | static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {} | 349 | static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {} |