• Jonas Meurer's avatar
    PM: suspend: Add sysfs attribute to control the "sync on suspend" behavior · c052bf82
    Jonas Meurer authored
    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.
    Signed-off-by: default avatarJonas Meurer <jonas@freesources.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    c052bf82
sysfs-power 16.5 KB