From: Greg Kroah-Hartman Date: Tue, 27 Sep 2016 14:26:48 +0000 (+0200) Subject: 4.7-stable patches X-Git-Tag: v4.7.6~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0c623b160f2c8ca05efcdf64230bd2165129b01;p=thirdparty%2Fkernel%2Fstable-queue.git 4.7-stable patches added patches: xfs-prevent-dropping-ioend-completions-during-buftarg-wait.patch --- diff --git a/queue-4.7/series b/queue-4.7/series index ecd73e89d61..22cd9db6826 100644 --- a/queue-4.7/series +++ b/queue-4.7/series @@ -10,3 +10,4 @@ autofs-use-dentry-flags-to-block-walks-during-expire.patch disable-maybe-uninitialized-warning-globally.patch disable-frame-address-warning.patch makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch +xfs-prevent-dropping-ioend-completions-during-buftarg-wait.patch diff --git a/queue-4.7/xfs-prevent-dropping-ioend-completions-during-buftarg-wait.patch b/queue-4.7/xfs-prevent-dropping-ioend-completions-during-buftarg-wait.patch new file mode 100644 index 00000000000..678c4f54c8e --- /dev/null +++ b/queue-4.7/xfs-prevent-dropping-ioend-completions-during-buftarg-wait.patch @@ -0,0 +1,55 @@ +From 800b2694f890cc35a1bda63501fc71c94389d517 Mon Sep 17 00:00:00 2001 +From: Brian Foster +Date: Fri, 26 Aug 2016 16:01:59 +1000 +Subject: xfs: prevent dropping ioend completions during buftarg wait + +From: Brian Foster + +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: +Signed-off-by: Brian Foster +Reviewed-by: Christoph Hellwig +Signed-off-by: Dave Chinner +Signed-off-by: Greg Kroah-Hartman + +--- + fs/xfs/xfs_buf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/xfs/xfs_buf.c ++++ b/fs/xfs/xfs_buf.c +@@ -1531,7 +1531,7 @@ xfs_wait_buftarg( + * ensure here that all reference counts have been dropped before we + * start walking the LRU list. + */ +- drain_workqueue(btp->bt_mount->m_buf_workqueue); ++ flush_workqueue(btp->bt_mount->m_buf_workqueue); + + /* loop until there is nothing left on the lru list. */ + while (list_lru_count(&btp->bt_lru)) {