]> Pileus Git - ~andy/linux/commitdiff
xfs: prevent recursion in xfs_buf_iorequest
authorChristoph Hellwig <hch@infradead.org>
Mon, 2 Jul 2012 10:00:04 +0000 (06:00 -0400)
committerBen Myers <bpm@sgi.com>
Fri, 13 Jul 2012 18:09:39 +0000 (13:09 -0500)
If the b_iodone handler is run in calling context in xfs_buf_iorequest we
can run into a recursion where xfs_buf_iodone_callbacks keeps calling back
into xfs_buf_iorequest because an I/O error happened, which keeps calling
back into xfs_buf_iorequest.  This chain will usually not take long
because the filesystem gets shut down because of log I/O errors, but even
over a short time it can cause stack overflows if run on the same context.

As a short term workaround make sure we always call the iodone handler in
workqueue context.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_buf.c

index a4beb421018a03aa84d0cb807d4a71b1db8f927b..687b275f165c3e8c844aa333bacdb1b298eef9ea 100644 (file)
@@ -1243,7 +1243,7 @@ xfs_buf_iorequest(
         */
        atomic_set(&bp->b_io_remaining, 1);
        _xfs_buf_ioapply(bp);
-       _xfs_buf_ioend(bp, 0);
+       _xfs_buf_ioend(bp, 1);
 
        xfs_buf_rele(bp);
 }