Re: [PATCH] Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"

Dave Chinner
2016-01-20T21:19:50Z

On Wed, Jan 20, 2016 at 09:47:50AM +0100, Michal Hocko wrote:
> On Wed 13-01-16 16:12:48, Dave Chinner wrote:
> > This reverts commit 24ba16bb3d499c49974669cd8429c3e4138ab102 as it
> > prevents machines from suspending. This regression occurs when the
> > xfsaild is idle on entry to suspend, and so there s no activity to
> > wake it from it's idle sleep and hence see that it is supposed to
> > freeze. Hence the freezer times out waiting for it and suspend is
> > cancelled.
> >
> > There is no obvious fix for this short of freezing the filesystem
> > properly, so revert this change for now.
>
> We had a similar report opensuse bugzilla just recently. I believe the
> proper fix should be the following:
....
> diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
> index aa67339b9537..d6c9c3e9e02b 100644
> --- a/fs/xfs/xfs_trans_ail.c
> +++ b/fs/xfs/xfs_trans_ail.c
> @@ -520,14 +520,14 @@ xfsaild(
> if (!xfs_ail_min(ailp) &&
> ailp->xa_target == ailp->xa_target_prev) {
> spin_unlock(&ailp->xa_lock);
> - schedule();
> + freezable_schedule();

Oh, wonderful. A completely separate set of undocumented schedule
functions defined inside the freezer header files that are needed
just for freezable kthreads. Perhaps there should be some
documentation somewhere on how to write suspend safe kthreads?

This is too late for the current merge window, but I'll queue it up
for the next one so we can get some testing on it first.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com