[PATCH] xfs: up(ic_sema) if flushing data device fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We flush the data device cache before we issue external log IO. Since
7d839e325af2, we check the return value of the flush, and if the flush
failed, we shut down the log immediately and return. However, the
iclog->ic_sema is left in a decremented state so let's add an up().
Prior to this patch, xfs/438 would fail consistently when running with
an external log device:

sync
  -> xfs_log_force
  -> xlog_write_iclog
      -> down(&iclog->ic_sema)
      -> blkdev_issue_flush (fail causes us to intiate shutdown)
          -> xlog_force_shutdown
          -> return

unmount
  -> xfs_log_umount
      -> xlog_wait_iclog_completion
          -> down(&iclog->ic_sema) --------> HANG

There is a second early return / shutdown. Add an up() there as well.

Fixes: 7d839e325af2 ("xfs: check return codes when flushing block devices")
Signed-off-by: Leah Rumancik <leah.rumancik@xxxxxxxxx>
---

Notes:
    Tested auto group for xfs/4k and xfs/logdev configs with no regressions
    seen.

 fs/xfs/xfs_log.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 51c100c86177..b4a8105299c2 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1926,6 +1926,7 @@ xlog_write_iclog(
 		 */
 		if (log->l_targ != log->l_mp->m_ddev_targp &&
 		    blkdev_issue_flush(log->l_mp->m_ddev_targp->bt_bdev)) {
+			up(&iclog->ic_sema);
 			xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
 			return;
 		}
@@ -1936,6 +1937,7 @@ xlog_write_iclog(
 	iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FUA);
 
 	if (xlog_map_iclog_data(&iclog->ic_bio, iclog->ic_data, count)) {
+		up(&iclog->ic_sema);
 		xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
 		return;
 	}
-- 
2.42.0.758.gaed0368e0e-goog




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux