]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: use dedicated log worker wq to avoid deadlock with cil wq
authorBrian Foster <bfoster@redhat.com>
Fri, 20 Oct 2017 21:46:35 +0000 (14:46 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Wed, 25 Oct 2017 02:27:01 +0000 (22:27 -0400)
commit015863aacea1bf013e0174de82152f3551cc5720
tree608ee1e6982be04f0548c80184f30af909c8f4cf
parent93bba3929aedf18ea6730d8f8502f86f93d52121
xfs: use dedicated log worker wq to avoid deadlock with cil wq

orabug: 26871913
backport: upstream 696a562072e3c14bcd13ae5acc19cdf27679e865 (no conflict)

The log covering background task used to be part of the xfssyncd
workqueue. That workqueue was removed as of commit 5889608df ("xfs:
syncd workqueue is no more") and the associated work item scheduled
to the xfs-log wq. The latter is used for log buffer I/O completion.

Since xfs_log_worker() can invoke a log flush, a deadlock is
possible between the xfs-log and xfs-cil workqueues. Consider the
following codepath from xfs_log_worker():

xfs_log_worker()
  xfs_log_force()
    _xfs_log_force()
      xlog_cil_force()
        xlog_cil_force_lsn()
          xlog_cil_push_now()
            flush_work()

The above is in xfs-log wq context and blocked waiting on the
completion of an xfs-cil work item. Concurrently, the cil push in
progress can end up blocked here:

xlog_cil_push_work()
  xlog_cil_push()
    xlog_write()
      xlog_state_get_iclog_space()
        xlog_wait(&log->l_flush_wait, ...)

The above is in xfs-cil context waiting on log buffer I/O
completion, which executes in xfs-log wq context. In this scenario
both workqueues are deadlocked waiting on eachother.

Add a new workqueue specifically for the high level log covering and
ail pushing worker, as was the case prior to commit 5889608df.

Diagnosed-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/xfs/xfs_log.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_super.c