Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3494002imu; Sun, 11 Nov 2018 16:21:55 -0800 (PST) X-Google-Smtp-Source: AJdET5eoqDNpNorQF7eAnbenorcayS9+skOfvDDsBVGeJCgrr/sqwwoh9kwUA2A2OQoRepkfxk5k X-Received: by 2002:a17:902:e193:: with SMTP id cd19-v6mr17937628plb.262.1541982115586; Sun, 11 Nov 2018 16:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541982115; cv=none; d=google.com; s=arc-20160816; b=CvWS0tkq4/zQrRuTBdDqTCDhyTj4dWgdgiomNXKmCWqqhPN2gf0bWnnSO+Sc6UF9K1 hPvLnI7UOnZHplwxjiCMXwOplPFVebV95DQXM6LSoe6j+WkAIyr/GV6nzH9r6qYYM9E/ rAHLYiAKtyRdpBJ+Pbq5dnQPVMUAd2wiMuA52g+Vo8SirNG4vrqQElLrtkAfecLdJ97c RIUHUHlTiwyAyWNHbCZRjz99f1WI6+tNbnxYaY2/4TOQ5kAUb9YwUUZvwjyHwxjG31dS HmwanzbNbJwf/T7TktlZmNRp00PzrslccWJDaOxQpyv+g7jp0+NBYk18YQyxwS1ud6Bt 5N9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4EgpiJf9WdGe50y0Ttr1SF59Y2p8rLNUl/my04u7Aas=; b=yaAX+l8mGFR5ALJ5U7bNSS6XzBXFLPVXpEU20irGcyqbChLVXIkwA/4Rp4LT4TaZ5o pcZQ9vkjF1uodQkk0govnqBv2ly6jWZsGGM+w7Q/eXN5snlQ1XOiI2JO1GS6MKierAv9 YJRV+QqKFfXH4x5Mdz6HzveA2v5J5GLrJP/PygzONdAMZoxKjQTFJ7WDXjOW/zOjJR0v B20tyjlCi/GRqyI7CpSf1yNQa5OndeEeUkv9zoKWhWo61t2A7qxJZweLL8gdIKvKACb6 A4vl6YpllWlVvbwu+nA5bNitLdLdLY8UA2Z/BE8GLY7y5UEvjoQvgt9PyqsQOTTEPB+k dhWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fHPnJjGU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4-v6si17325381pln.67.2018.11.11.16.21.40; Sun, 11 Nov 2018 16:21:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fHPnJjGU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729792AbeKLIQw (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:58446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbeKLIQw (ORCPT ); Mon, 12 Nov 2018 03:16:52 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F7C7214F1; Sun, 11 Nov 2018 22:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975216; bh=mufrby9rZjPI8oB8NF5bn08Du7RyOw90z8Yai7pSIXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHPnJjGUbY+kBod23nJfjc9KD4IH07ZAdGfU0Db9nehpk6CZGVz0k4xauO2pATqUy ph7Ez8u4eRluZOENmOaEAnvYMmwMylUK5LYa0mLx17v1ld2wtf4C69gtMOQF/7V5xW CC7bMXyWKRPl2WL9CEOsowWG8l7HKKEC+sHhFp0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Junhui , Coly Li , Jens Axboe Subject: [PATCH 4.19 013/361] bcache: fix ioctl in flash device Date: Sun, 11 Nov 2018 14:16:00 -0800 Message-Id: <20181111221621.792101493@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tang Junhui commit dd0c91793b7c2658ea32c6b3a2247a8ceca45dc0 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/request.c | 3 +++ drivers/md/bcache/super.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1218,6 +1218,9 @@ static int cached_dev_ioctl(struct bcach { 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); } --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -643,10 +643,6 @@ static int ioctl_dev(struct block_device 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); }