From patchwork Mon Jul 8 00:50:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 1128798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45hn2z17d2z9sNj; Mon, 8 Jul 2019 10:51:55 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hkHsl-0002hh-6K; Mon, 08 Jul 2019 00:51:51 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hkHsb-0002aK-4y for kernel-team@lists.ubuntu.com; Mon, 08 Jul 2019 00:51:41 +0000 Received: from mail-qt1-f199.google.com ([209.85.160.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hkHsa-0004dv-Dc for kernel-team@lists.ubuntu.com; Mon, 08 Jul 2019 00:51:40 +0000 Received: by mail-qt1-f199.google.com with SMTP id s9so15151331qtn.14 for ; Sun, 07 Jul 2019 17:51:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=xeT2YkOmmlnXEUVtLi82Ypc3nCY+XpqMJcTlpUyvV28=; b=Q6tGv14hECe+bTH8DNiRlG9aKY4r+EFGsgm6r3GHeT5ic7KfE4Uo/Q8eGzP+jHkzZl J/OQfZRHYEpuRioz6BRxHgiROXmZwCT/EdwXoyzdniENcVmcgS02TKooIQJazzAibPem k7AFnWnvAewBBpdX2DekHi023dSDE9ATE0AfrTbZ7harOvJ27xU6QaJB2T8UdcT9xCBn kdlp7WIW1KLFTynplF9M+yzmycKnY7PEEyNUOKpILN2sdQOXFQvEySpl9w6oFKmZap09 IhZ1xh1z11xHFu70fu3iV44rq7DQ65Jlcfk9Nw47uLVYttajaelTtjyFvZZoSH7ywvC9 KGvw== X-Gm-Message-State: APjAAAVxvcUOsYuqYtCPB6PA5siONpvkptdax4u5YU0lNvLZPQ4pVX+Y zZBTbx8WPYYTsUAD2RHlTMdFyeK3oupwa+5zeMGz5GA1uOQkDxKyrrn3U0Er5n6QwDmfFs0ctEZ 3SzthblUX0iLQClfZbjtfthfZT9BCfx0d3p01Zqg+Fg== X-Received: by 2002:a05:620a:44:: with SMTP id t4mr12163411qkt.189.1562547099556; Sun, 07 Jul 2019 17:51:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoBtynjhPuBs/bBa4QIGRFWXPLCuEhGHzD0zNTRj583FiyU2KbiFApVBXLfkljDNH4ld3D9g== X-Received: by 2002:a05:620a:44:: with SMTP id t4mr12163408qkt.189.1562547099381; Sun, 07 Jul 2019 17:51:39 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:4e7:1017:3da7:3d04:ea25:3a0]) by smtp.gmail.com with ESMTPSA id t197sm6697527qke.2.2019.07.07.17.51.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 07 Jul 2019 17:51:39 -0700 (PDT) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [B][PATCH 11/11] bcache: fix ioctl in flash device Date: Sun, 7 Jul 2019 21:50:38 -0300 Message-Id: <20190708005038.13184-12-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190708005038.13184-1-mfo@canonical.com> References: <20190708005038.13184-1-mfo@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Tang Junhui BugLink: https://bugs.launchpad.net/bugs/1829563 When doing ioctl in flash device, it will call ioctl_dev() in super.c, then we should not to get cached device since flash only device has no backend device. This patch just move the jugement dc->io_disable to cached_dev_ioctl() to make ioctl in flash device correctly. Fixes: 0f0709e6bfc3c ("bcache: stop bcache device when backing device is offline") Signed-off-by: Tang Junhui Cc: stable@vger.kernel.org Signed-off-by: Coly Li Signed-off-by: Jens Axboe (backported from commit dd0c91793b7c2658ea32c6b3a2247a8ceca45dc0) [mfo: backport: request.c/hunk 1: insert blank line, refresh one context line.] Signed-off-by: Mauricio Faria de Oliveira --- drivers/md/bcache/request.c | 4 ++++ drivers/md/bcache/super.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 7beec0c53fff..9231292c364a 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1154,6 +1154,10 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode, unsigned int cmd, unsigned long arg) { struct cached_dev *dc = container_of(d, struct cached_dev, disk); + + if (dc->io_disable) + return -EIO; + return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 6d49b758c552..c67cf28f6714 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -652,10 +652,6 @@ static int ioctl_dev(struct block_device *b, fmode_t mode, unsigned int cmd, unsigned long arg) { struct bcache_device *d = b->bd_disk->private_data; - struct cached_dev *dc = container_of(d, struct cached_dev, disk); - - if (dc->io_disable) - return -EIO; return d->ioctl(d, mode, cmd, arg); }