All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: prevent dropping ioend completions during buftarg wait
@ 2016-08-24 12:55 Brian Foster
  2016-08-25  8:12 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Foster @ 2016-08-24 12:55 UTC (permalink / raw)
  To: xfs

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.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 607cc29..b5b9bff 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1611,7 +1611,7 @@ xfs_wait_buftarg(
 	 */
 	while (percpu_counter_sum(&btp->bt_io_count))
 		delay(100);
-	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)) {
-- 
2.5.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: prevent dropping ioend completions during buftarg wait
  2016-08-24 12:55 [PATCH] xfs: prevent dropping ioend completions during buftarg wait Brian Foster
@ 2016-08-25  8:12 ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-08-25  8:12 UTC (permalink / raw)
  To: Brian Foster; +Cc: xfs

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: prevent dropping ioend completions during buftarg wait
  2016-09-27 14:17   ` Greg KH
@ 2016-09-27 14:22     ` Brian Foster
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Foster @ 2016-09-27 14:22 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, david, hch

On Tue, Sep 27, 2016 at 04:17:40PM +0200, Greg KH wrote:
> On Tue, Sep 27, 2016 at 10:03:57AM -0400, Brian Foster wrote:
> > 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>
> > ---
> > 
> > Note that this applies to linux-4.7.y.
> 
> It also applied to 4.4-stable, should I put it there as well?
> 

Yeah, it looks like we included "xfs: log mount failures don't wait for
buffers to be released" there so that probably makes sense. Thanks!

Brian

> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: prevent dropping ioend completions during buftarg wait
  2016-09-27 14:03 ` [PATCH] xfs: prevent dropping ioend completions during buftarg wait Brian Foster
@ 2016-09-27 14:17   ` Greg KH
  2016-09-27 14:22     ` Brian Foster
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-09-27 14:17 UTC (permalink / raw)
  To: Brian Foster; +Cc: stable, david, hch

On Tue, Sep 27, 2016 at 10:03:57AM -0400, Brian Foster wrote:
> 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>
> ---
> 
> Note that this applies to linux-4.7.y.

It also applied to 4.4-stable, should I put it there as well?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] xfs: prevent dropping ioend completions during buftarg wait
  2016-09-09 16:04 FAILED: patch "[PATCH] xfs: prevent dropping ioend completions during buftarg wait" failed to apply to 4.7-stable tree gregkh
@ 2016-09-27 14:03 ` Brian Foster
  2016-09-27 14:17   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Foster @ 2016-09-27 14:03 UTC (permalink / raw)
  To: stable; +Cc: bfoster, david, hch

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>
---

Note that this applies to linux-4.7.y.

Brian

 fs/xfs/xfs_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index e71cfbd..41c20b6 100644
--- 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)) {
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-27 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 12:55 [PATCH] xfs: prevent dropping ioend completions during buftarg wait Brian Foster
2016-08-25  8:12 ` Christoph Hellwig
2016-09-09 16:04 FAILED: patch "[PATCH] xfs: prevent dropping ioend completions during buftarg wait" failed to apply to 4.7-stable tree gregkh
2016-09-27 14:03 ` [PATCH] xfs: prevent dropping ioend completions during buftarg wait Brian Foster
2016-09-27 14:17   ` Greg KH
2016-09-27 14:22     ` Brian Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.