Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbcLEOzO (ORCPT ); Mon, 5 Dec 2016 09:55:14 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:36712 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbcLEOzM (ORCPT ); Mon, 5 Dec 2016 09:55:12 -0500 Subject: Re: [PATCH] block: fix unintended fallthrough in generic_make_request_checks() To: Nicolai Stange References: <20161204135639.7016-1-nicstange@gmail.com> Cc: Chaitanya Kulkarni , Shaun Tancheff , Damien Le Moal , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org From: Jens Axboe Message-ID: <23525ed3-2a62-7d61-954c-084b891daced@kernel.dk> Date: Mon, 5 Dec 2016 07:55:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161204135639.7016-1-nicstange@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1583 Lines: 42 On 12/04/2016 06:56 AM, Nicolai Stange wrote: > Since commit e73c23ff736e ("block: add async variant of > blkdev_issue_zeroout") messages like the following show up: > > EXT4-fs (dm-1): Delayed block allocation failed for inode 2368848 at > logical offset 0 with max blocks 1 with error 95 > EXT4-fs (dm-1): This should not happen!! Data will be lost > > Due to the following fallthrough introduced with > commit 2d253440b5af ("block: Define zoned block device operations"), > generic_make_request_checks() would accept a REQ_OP_WRITE_SAME bio only > if the block device supports "write same" *and* is a zoned one: > > switch (bio_op(bio)) { > [...] > case REQ_OP_WRITE_SAME: > if (!bdev_write_same(bio->bi_bdev)) > goto not_supported; > case REQ_OP_ZONE_REPORT: > case REQ_OP_ZONE_RESET: > if (!bdev_is_zoned(bio->bi_bdev)) > goto not_supported; > break; > [...] > } > > Thus, although the bio setup as done by __blkdev_issue_write_same() from > commit e73c23ff736e ("block: add async variant of blkdev_issue_zeroout") > would succeed, its actual submission would not, resulting in the > EOPNOTSUPP == 95. > > Fix this by removing the fallthrough which, due to the lack of an explicit > comment, seems to be unintended anyway. > > Fixes: e73c23ff736e ("block: add async variant of blkdev_issue_zeroout") > Fixes: 2d253440b5af ("block: Define zoned block device operations") > Signed-off-by: Nicolai Stange Added, thanks. -- Jens Axboe