On Fri, Jan 23, 2009 at 03:14:30PM -0500, Mikulas Patocka wrote:
> On Thu, 22 Jan 2009, Christoph Hellwig wrote:
> > On Thu, Jan 22, 2009 at 03:59:13PM -0500, Christoph Hellwig wrote:
> > > On Wed, Jan 21, 2009 at 10:24:22AM +1100, Dave Chinner wrote:
> > > > Right, so you need to use internal xfs sync functions that don't
> > > > have these problems. That is:
> > > >
> > > > error = xfs_sync_inodes(ip->i_mount, SYNC_DELWRI|SYNC_WAIT);
> > > >
> > > > will do a blocking flush of all the inodes without deadlocks occurring.
> > > > Then you can remove the 500ms wait.
> > >
> > > I've given this a try with Eric's testcase from #724 in the oss bugzilla,
> > > but it's not enough yet. I thinks that's because SYNC_WAIT is rather
> > > meaningless for data writeout, and we need SYNC_IOWAIT instead. The
> > > patch below gets the testcase working for me:
> > Actually I still see failures happing sometimes. I guess tha'ts because
> > our flush is still asynchronous due to the schedule_work..
> If I placed
> xfs_sync_inodes(ip->i_mount, SYNC_DELWRI);
> xfs_sync_inodes(ip->i_mount, SYNC_DELWRI | SYNC_IOWAIT);
> directly to xfs_flush_device, I got lock dependency warning (though not a
> real deadlock).
Same reason memory reclaim gives lockdep warnings on XFS - we're
recursing into operations that take inode locks while we currently
hold an inode lock. However, it shouldn't deadlock because
we should ever try to take the iolock on the inode that we current
hold it on.
> So synchronous flushing definitely needs some thinking and lock
No, not at all. At most the grabbing of the iolock in
xfs_sync_inodes_ag() needs to become a trylock....