From: Alex Bligh Subject: [BUG] + possible [PATCH]. blkdev_issue_flush is a NOOP for request based drivers Date: Thu, 26 May 2011 12:00:36 +0100 Message-ID: Reply-To: Alex Bligh Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Alex Bligh To: linux-fsdevel@vger.kernel.org, Tejun Heo , Jan Kara Return-path: Received: from mail.avalus.com ([89.16.176.221]:35244 "EHLO mail.avalus.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753812Ab1EZLAj (ORCPT ); Thu, 26 May 2011 07:00:39 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: blkdev_issue_flush appears to be a NOOP for request-based srivers, because it returns -ENXIO if no make_request_function is present. AIUI only bio based drivers have a make_request_function. The preceding comment suggests this is an attempt to avoid making a request to bio based drivers before their queue is set up. This should not exclude request based drivers from getting any flushes. Instead therefore check for EITHER make_request_function OR request_function and queue flags. The check for queue flags may be unnecessary as the block layer may simply not send the flush on. -- Alex Bligh Signed-Off-By: Alex Bligh diff --git a/block/blk-flush.c b/block/blk-flush.c index 6c9b5e1..3a6d4bd 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -405,13 +405,14 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, /* * some block devices may not have their queue correctly set up here * (e.g. loop device without a backing file) and so issuing a flush * here will panic. Ensure there is a request function before issuing * the flush. */ - if (!q->make_request_fn) + if (!q->make_request_fn && + !(q->request_fn && (q->flush_flags & REQ_FLUSH))) return -ENXIO; bio = bio_alloc(gfp_mask, 0); bio->bi_end_io = bio_end_flush; bio->bi_bdev = bdev; bio->bi_private = &wait;