Re: [RFC 2/5] fs: freeze on suspend and thaw on resume

From: Jiri Kosina
Date: Tue Oct 03 2017 - 16:06:34 EST


On Tue, 3 Oct 2017, Luis R. Rodriguez wrote:

> This uses the existing filesystem freeze and thaw callbacks to
> freeze each filesystem on suspend/hibernation and thaw upon resume.
>
> This is needed so that we properly really stop IO in flight without
> races after userspace has been frozen. Without this we rely on
> kthread freezing and its semantics are loose and error prone.
> For instance, even though a kthread may use try_to_freeze() and end
> up being frozen we have no way of being sure that everything that
> has been spawned asynchronously from it (such as timers) have also
> been stopped as well.
>
> A long term advantage of also adding filesystem freeze / thawing
> supporting durign suspend / hibernation is that long term we may
> be able to eventually drop the kernel's thread freezing completely
> as it was originally added to stop disk IO in flight as we hibernate
> or suspend.
>
> This also implies that many kthread users exist which have been
> adding freezer semantics onto its kthreads without need. These also
> will need to be reviewed later.
>
> This is based on prior work originally by Rafael Wysocki and later by
> Jiri Kosina.
>
> Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx>

Thanks a lot for picking this up; I never found time to actually finalize
it.

Acked-by: Jiri Kosina <jkosina@xxxxxxx>

for patches 2 and 5 (the fs agnostic code), which were in the core of my
original work.

--
Jiri Kosina
SUSE Labs