xfs
[Top] [All Lists]

[PATCH] xfs_buf_iodone_callbacks to force shutdown & resubmit buf in cas

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs_buf_iodone_callbacks to force shutdown & resubmit buf in case of permanent failure
From: Shyam Kaushik <shyam@xxxxxxxxxxxxxxxxx>
Date: Tue, 26 Apr 2016 19:31:59 +0530
Cc: Alex Lyakas <alex@xxxxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zadarastorage-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:thread-index:date:message-id:subject:to:cc; bh=qaouIlYGZ2LSAc1IWrt7XAlT2sBaCJzVCoEXc4NXtHU=; b=lswlFPda0zPBu4sk2IsDJwIADiMuWpFe/8nxq2JEa6OAJxHP/vuXK0JNIp8VW5/xam +A8YS+jn8q3EaZQZwdkSe85cjJFGhsVttbK7fgCqNvl2HyyfU2SEjClsJw6soExep4PA FqhlqTGLy74nsGtexaoO6My6q6GLxp5DrC71lUoFFIlXQ6gCzVmuxOl934v9Ab7QzSWA ZeC4Z2I3Z+hgY2MNcBpODS0q29c5skysdIuL1r2T+orY6lp/YxFLguNM/pmlaRsc4aMo YKHktjutVCB42x0ynPX6nfebBHiKhcocKbOvBWmUsmpODrN2tBqt634RMqwTzkjffZf9 PT7Q==
Thread-index: AdGfxDOTYCTqo7DyQ3SbW7clHfIRpA==
When XFS underlying disk fails, it could take several milliseconds for the
FS to be marked
shutdown. xfs_buf_iodone_callbacks() retries buf upon first failure by
submitting it once
again. But if the buf fails 2nd time before FS is marked for shutdown, it
just releases the
buf with xfs_buf_relse(). This is flawed that nobody is releasing the
XFS_IFLOCK on the inode.
Because of this AIL tasks repeated effort to xfs_inode_item_push() will
see that xfs_iflock()
cannot be acquired. This blocks XFS from being unmounted as
xfs_ail_push_all_sync() will keep
looping without progress.

Fix this by marking the FS for shutdown if we have a permanent failure &
resubmit the buf.
xfs_buf_submit() will see FS marked for shutdown & invoke the callback
which releases
XFS_IFLOCK.

diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 1a6c9b9..6f73ee0 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1100,7 +1100,12 @@ xfs_buf_iodone_callbacks(
                                       XBF_DONE | XBF_WRITE_FAIL;
                        xfs_buf_submit(bp);
                } else {
-                       xfs_buf_relse(bp);
+                       /*
+                       * if we have the buf fail 2nd time, force a FS
shutdown & resubmit
+                       * the buf for it to be failed back immediately
+                       */
+                       xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
+                       xfs_buf_submit(bp);
                }

                return;

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