Chandra Seetharaman 297aa63769 xfs: Fix a deadlock in xfs_log_commit_cil() code path
While testing and rearranging pquota/gquota code, I stumbled
on a xfs_shutdown() during a mount. But the mount just hung.

Debugged and found that there is a deadlock involving
&log->l_cilp->xc_ctx_lock.

It is in a code path where &log->l_cilp->xc_ctx_lock is first
acquired in read mode and some levels down the same semaphore
is being acquired in write mode causing a deadlock.

This is the stack:
xfs_log_commit_cil -> acquires &log->l_cilp->xc_ctx_lock in read mode
  xlog_print_tic_res
    xfs_force_shutdown
      xfs_log_force_umount
        xlog_cil_force
          xlog_cil_force_lsn
            xlog_cil_push_foreground
              xlog_cil_push - tries to acquire same semaphore in write mode

This patch fixes the deadlock by changing the reason code for
xfs_force_shutdown in xlog_print_tic_res() to SHUTDOWN_LOG_IO_ERROR.

SHUTDOWN_LOG_IO_ERROR is the right reason code to be set since
we are in the log path.

Thanks to Dave for suggesting this solution.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
2013-07-22 13:58:10 -05:00
..
2013-05-07 18:45:36 -05:00
2013-06-27 13:34:12 -05:00
2013-05-07 18:45:36 -05:00
2012-11-19 20:11:24 -06:00
2013-04-21 14:57:43 -05:00
2013-05-30 17:26:31 -05:00
2013-05-30 17:26:31 -05:00
2013-05-07 18:45:36 -05:00
2013-05-30 17:26:31 -05:00
2012-11-19 20:11:24 -06:00
2013-07-13 11:40:24 -07:00
2013-07-09 12:29:12 -07:00
2013-06-29 12:57:00 +04:00
2013-06-29 12:57:00 +04:00
2013-06-29 12:57:00 +04:00
2013-06-27 14:27:18 -05:00
2013-06-27 14:26:21 -05:00
2013-06-27 13:34:12 -05:00
2013-06-27 13:34:12 -05:00
2013-05-07 18:45:36 -05:00
2013-06-27 13:34:12 -05:00
2013-05-07 18:45:36 -05:00
2013-05-07 18:45:36 -05:00
2013-06-19 14:54:17 -05:00
2012-10-17 12:01:25 -05:00
2013-07-09 12:29:12 -07:00
2013-06-27 13:34:12 -05:00
2013-06-29 12:57:00 +04:00
2013-05-07 18:45:36 -05:00