summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/request.c
diff options
context:
space:
mode:
authorTang Junhui <tang.junhui.linux@gmail.com>2018-10-08 15:41:10 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-13 22:08:15 +0300
commit32870e2bb60041867764cc85634c0d9023040e35 (patch)
tree4e31a02a3187f4721ca071a58f236fb785afde11 /drivers/md/bcache/request.c
parentfec039ec69c8e1ba4ba6a4bc040e45d2ea5a6dfe (diff)
downloadlinux-32870e2bb60041867764cc85634c0d9023040e35.tar.xz
bcache: fix ioctl in flash device
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 <tang.junhui.linux@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/bcache/request.c')
-rw-r--r--drivers/md/bcache/request.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 4946d486f734..22944aa7d8e5 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1218,6 +1218,9 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode,
{
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);
}