[Top] [All Lists]

[PATCH 1/2] xfs: prevent recursion in xfs_buf_iorequest

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/2] xfs: prevent recursion in xfs_buf_iorequest
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 02 Jul 2012 06:00:04 -0400
References: <20120702100003.960640484@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
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@xxxxxx>

 fs/xfs/xfs_buf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: xfs/fs/xfs/xfs_buf.c
--- xfs.orig/fs/xfs/xfs_buf.c   2012-06-26 23:20:22.369740722 +0200
+++ xfs/fs/xfs/xfs_buf.c        2012-06-26 23:20:23.686407379 +0200
@@ -1243,7 +1243,7 @@ xfs_buf_iorequest(
        atomic_set(&bp->b_io_remaining, 1);
-       _xfs_buf_ioend(bp, 0);
+       _xfs_buf_ioend(bp, 1);

<Prev in Thread] Current Thread [Next in Thread>