From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:35132 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933738AbcI0OWz (ORCPT ); Tue, 27 Sep 2016 10:22:55 -0400 Date: Tue, 27 Sep 2016 10:22:53 -0400 From: Brian Foster To: Greg KH Cc: stable@vger.kernel.org, david@fromorbit.com, hch@lst.de Subject: Re: [PATCH] xfs: prevent dropping ioend completions during buftarg wait Message-ID: <20160927142253.GB38187@bfoster.bfoster> References: <147343704512166@kroah.com> <1474985037-50682-1-git-send-email-bfoster@redhat.com> <20160927141740.GA22526@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160927141740.GA22526@kroah.com> Sender: stable-owner@vger.kernel.org List-ID: 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: > > Signed-off-by: Brian Foster > > Reviewed-by: Christoph Hellwig > > Signed-off-by: Dave Chinner > > --- > > > > 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