Re: [PATCH v2] PM: Add configurable sync timeout for suspend and hibernation

tuhaowen
2025-09-08T02:30:35Z

On Fri, Sep 5, 2025 at 9:27 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, Sep 5, 2025 at 11:25 AM tuhaowen <tuhaowen@uniontech.com> wrote:
> >
> > When large file operations are in progress during system suspend or
> > hibernation, the ksys_sync() call can hang for extended periods,
> > leading to unresponsive system behavior. Users copying large files
> > to USB drives may experience black screen hangs when attempting to
> > suspend, requiring forced power cycles.
>
> You need to talk to the authors of the series mentioned above (now
> CCed) and come up with a common approach. I have no strong preference
> and I'm not going to choose one over the other unless I'm told by
> everybody interested that this is the way to go.
>
> I personally think that syncing filesystems during system suspend, in
> contrast with hibernation, is rather pointless and hibernation users
> can be expected to be sufficiently patient.
>
> There's already /sys/power/sync_on_suspend, so why not use it to
> disable the sync on suspend altogether?

Hi Rafael,

Thank you for your feedback on the sync timeout patch.

Regarding your suggestion to use /sys/power/sync_on_suspend to disable sync
altogether, I have concerns about this approach. When resuming from S3
suspend or hibernation, USB and other removable block devices often
disconnect and get rescanned by the kernel. If we disable sync completely
before suspend, any pending writes in the page cache will be lost when
these devices disconnect during the sleep cycle. This can lead to
filesystem metadata corruption, partition table corruption on USB drives,
and data loss for users who were writing files before suspend.

No major Linux distribution dares to enable the sync_on_suspend disable
option by default precisely because of these data corruption risks.

Regarding coordination with the patch series mentioned above, I understand
the need for alignment and I'm actively working on this. I have initiated
discussions with Samuel Wu and the Google team to explore how we can merge
our approaches into a unified solution.

I will coordinate with them to present a unified patch series that
incorporates the best aspects of both approaches.

Best regards,
Haowen Tu