Re: [PATCH] sync_sb_inodes sync hang

From: Hugh Dickins
Date: Thu Feb 26 2004 - 16:26:19 EST


On 26 Feb 2004, Daniel McNeil wrote:
>
> I tried the while loop below on a UP without PREEMPT and it has
> not hung running 2.6.3-mm3 without your patch.
>
> How long does it take to hang?

About 2 seconds.

> Which file system?

ext2.

(Of course my patch was very stupid one, merely allowing the
busyloop to be broken into and eventually brought to an end:
as I realized just after sending it, but knew I could rely
on Andrew to see through its stupidity!)

Hugh

> On Tue, 2004-02-24 at 08:52, Hugh Dickins wrote:
> > 2.6.3-mm UP without PREEMPT easily hangs looping around pdflush's
> > sync_sb_inodes, failing the down_read_trylock in do_writepages,
> > but giving the concurrent sync no chance to complete: just try
> > while : ; do echo $SECONDS; sync; cp /etc/termcap .; done
> >
> > I think sync_sb_inodes is the only loop vulnerable to that
> > change in do_writepages, so site the cond_resched() here.
> >
> > Hugh
> >
> > --- 2.6.3-mm3/fs/fs-writeback.c 2004-02-23 12:51:49.000000000 +0000
> > +++ linux/fs/fs-writeback.c 2004-02-24 16:14:49.000000000 +0000
> > @@ -326,6 +326,7 @@ sync_sb_inodes(struct super_block *sb, s
> > writeback_release(bdi);
> > spin_unlock(&inode_lock);
> > iput(inode);
> > + cond_resched();
> > spin_lock(&inode_lock);
> > if (wbc->nr_to_write <= 0)
> > break;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/