]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: make inode flush at ENOSPC synchronous
authorDave Chinner <david@fromorbit.com>
Mon, 6 Apr 2009 16:45:44 +0000 (18:45 +0200)
committerChristoph Hellwig <hch@brick.lst.de>
Mon, 6 Apr 2009 16:45:44 +0000 (18:45 +0200)
commit506a6cb473aa1805e4a2d8b753b0bac2e8ac7bb8
tree5462388cdb6b36b2f0f1cf75dc6ee60a7c643a23
parent36f52d21b55cbf055f1875f251fca02dc6d5fe42
xfs: make inode flush at ENOSPC synchronous

When we are writing to a single file and hit ENOSPC, we trigger a background
flush of the inode and try again.  Because we hold page locks and the iolock,
the flush won't proceed until after we release these locks. This occurs once
we've given up and ENOSPC has been reported. Hence if this one is the only
dirty inode in the system, we'll get an ENOSPC prematurely.

To fix this, remove the async flush from the allocation routines and move
it to the top of the write path where we can do a synchronous flush
and retry the write again. Only retry once as a second ENOSPC indicates
that we really are ENOSPC.

This avoids a page cache deadlock when trying to do this flush synchronously
in the allocation layer that was identified by Mikulas Patocka.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/linux-2.6/xfs_lrw.c
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/linux-2.6/xfs_sync.h
fs/xfs/xfs_iomap.c