Re: [REVIEW] xfssyncd lost wakes circa 2.6.32

Ben Myers
2011-11-23T20:30:24Z

On Thu, Nov 24, 2011 at 06:42:16AM +1100, NeilBrown wrote:
> On Wed, 23 Nov 2011 10:30:46 -0600 Ben Myers <bpm@sgi.com> wrote:
> > Index: linux/fs/xfs/linux-2.6/xfs_sync.c
> > ===================================================================
> > --- linux.orig/fs/xfs/linux-2.6/xfs_sync.c
> > +++ linux/fs/xfs/linux-2.6/xfs_sync.c
> > @@ -620,13 +620,25 @@ xfssyncd(
> > set_freezable();
> > timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
> > for (;;) {
> > - timeleft = schedule_timeout_interruptible(timeleft);
> > - /* swsusp */
> > - try_to_freeze();
> > - if (kthread_should_stop() && list_empty(&mp->m_sync_list))
> > + set_current_state(TASK_INTERRUPTIBLE);
> > + spin_lock(&mp->m_sync_lock);
> > +
> > + if (list_empty(&mp->m_sync_list) && !kthread_should_stop()) {
> > + spin_unlock(&mp->m_sync_lock);
> > +
> > + timeleft = schedule_timeout_interruptible(timeleft);
>
> This should be just "schedule_timeout(timeleft)".
> This call sets TASK_INTERRUPTIBLE so we will go to sleep even if we were
> only just woken up.
>
> I don't really know the XFS code well enough to the rest looks right, but
> with that small fix it certainly doesn't look wrong :-)

Thanks Neil! I'll get that fixed up. ;)

-Ben