From patchwork Sun Dec 4 13:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolai Stange X-Patchwork-Id: 9460073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF7AB6071C for ; Sun, 4 Dec 2016 13:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B0BA262AE for ; Sun, 4 Dec 2016 13:57:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CF7D27570; Sun, 4 Dec 2016 13:57:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B62B262AE for ; Sun, 4 Dec 2016 13:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750922AbcLDN5L (ORCPT ); Sun, 4 Dec 2016 08:57:11 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34755 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbcLDN5L (ORCPT ); Sun, 4 Dec 2016 08:57:11 -0500 Received: by mail-wm0-f65.google.com with SMTP id g23so10134474wme.1; Sun, 04 Dec 2016 05:57:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=9OJHsPuQCxh7lQv6jI1erWvR3FahLhGDIDKJ1tFwUaE=; b=XYaaTkzcZaavof0vrNnYsMX2xRnrgydFK99c/VQ005c0O0+sRXh/nbdty84ddEADHr 4pLRxC/XW8i2yBv0PJq3A7MXzbLgKo/Ps+/J3jmYnjIdUdq2T0zLOkjV3E1ydftGnoFW 8z4V1vQeR+UvgraCUq77CO3BUI1Rx/syOMWBgQ14pSN/Fu76RiPyELNWWBmsYISdoHpM 4ebjAXr+85cjqCZF5S8i0AsTEA+11ZWVOynDqtW5bZWo+eplX3mzQpxrwB8ZsIa2ujrD KATyeqfUAdk+Srogt0h6HuZJM+3YO1beTaknHGg51Y3utsy6S9ihHRJXm8RitVXYH2GG XsmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9OJHsPuQCxh7lQv6jI1erWvR3FahLhGDIDKJ1tFwUaE=; b=FAaseZjg99ufUDQqAR4MDo0Zj3Rjgj4AwcccvxjbdxsnDwOua+oNOMmTLUgnbqhIZJ kg/Y24/FlASr5BylXAQLoxzu1esgRSW+3hoeO5WV3CYSfHk/tDH27Ew1R8tQr1DeWsKK E3eVrilWwir8rQRA1xgz+Qr6N6/+7isYvONjvMjtObxa96wCrecP0eGTsmhWUXAVygn7 7QOqXQejRrBeh5yla/9oVnayfEC1CvYbB/gE6Wqi1xgVr6O2RQ0++jAn8LgMAEo80RuY tdCNzWVuOLIFZ+mg9USYQYhwLvi1yrKLqLqAPEGdGAYRCjwrk4SuAQO7kwK9a42cJyaa hNBw== X-Gm-Message-State: AKaTC02MddoINCiCOHd74y25eHcIK8lSkXJdzg4HEVNMKJuOVZ4VMgOdT3lnQ4sxG6ZkDg== X-Received: by 10.28.72.3 with SMTP id v3mr6019837wma.20.1480859819083; Sun, 04 Dec 2016 05:56:59 -0800 (PST) Received: from localhost (x4e36702f.dyn.telefonica.de. [78.54.112.47]) by smtp.gmail.com with ESMTPSA id w79sm7444751wmw.0.2016.12.04.05.56.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Dec 2016 05:56:58 -0800 (PST) From: Nicolai Stange To: Jens Axboe Cc: Chaitanya Kulkarni , Shaun Tancheff , Damien Le Moal , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH] block: fix unintended fallthrough in generic_make_request_checks() Date: Sun, 4 Dec 2016 14:56:39 +0100 Message-Id: <20161204135639.7016-1-nicstange@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Christoph Hellwig --- Applicable to next-20161202. Note that after this patch, I'm seeing a single EXT4-fs (dm-1): Delayed block allocation failed for inode 2625094 at logical offset 2032 with max blocks 2 with error 121 with 121 == EREMOTEIO This is because my SATA sda reports 0x20 (invalid command) back in response to 0x41 (WRITE_SAME). After this has happened, sd_done() disables "write same" once and for all, hence only this single message. I expect this to get fixed by https://patchwork.kernel.org/patch/9321963/ block/blk-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/blk-core.c b/block/blk-core.c index 24de87d..1998aa4 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1947,6 +1947,7 @@ generic_make_request_checks(struct bio *bio) case REQ_OP_WRITE_SAME: if (!bdev_write_same(bio->bi_bdev)) goto not_supported; + break; case REQ_OP_ZONE_REPORT: case REQ_OP_ZONE_RESET: if (!bdev_is_zoned(bio->bi_bdev))