]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
xfs: prevent dropping ioend completions during buftarg wait
authorBrian Foster <bfoster@redhat.com>
Fri, 26 Aug 2016 06:01:59 +0000 (16:01 +1000)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 20 Oct 2016 13:06:15 +0000 (08:06 -0500)
commit02d91b5483df74142cc661047f8f8612f2a27d77
treebc9139c55e3bbbfc792e75a31d198f4bbf539766
parent53703dfb7cda0637696fc0d8ec8339dbeb12b51a
xfs: prevent dropping ioend completions during buftarg wait

BugLink: http://bugs.launchpad.net/bugs/1629386
commit 800b2694f890cc35a1bda63501fc71c94389d517 upstream.

xfs_wait_buftarg() waits for all pending I/O, drains the ioend
completion workqueue and walks the LRU until all buffers in the cache
have been released. This is traditionally an unmount operation` but the
mechanism is also reused during filesystem freeze.

xfs_wait_buftarg() invokes drain_workqueue() as part of the quiesce,
which is intended more for a shutdown sequence in that it indicates to
the queue that new operations are not expected once the drain has begun.
New work jobs after this point result in a WARN_ON_ONCE() and are
otherwise dropped.

With filesystem freeze, however, read operations are allowed and can
proceed during or after the workqueue drain. If such a read occurs
during the drain sequence, the workqueue infrastructure complains about
the queued ioend completion work item and drops it on the floor. As a
result, the buffer remains on the LRU and the freeze never completes.

Despite the fact that the overall buffer cache cleanup is not necessary
during freeze, fix up this operation such that it is safe to invoke
during non-unmount quiesce operations. Replace the drain_workqueue()
call with flush_workqueue(), which runs a similar serialization on
pending workqueue jobs without causing new jobs to be dropped. This is
safe for unmount as unmount independently locks out new operations by
the time xfs_wait_buftarg() is invoked.

cc: <stable@vger.kernel.org>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/xfs/xfs_buf.c