[B][PATCH 11/11] bcache: fix ioctl in flash device
Mauricio Faria de Oliveira
mfo at canonical.com
Mon Jul 8 00:50:38 UTC 2019
From: Tang Junhui <tang.junhui.linux at gmail.com>
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 <tang.junhui.linux at gmail.com>
Cc: stable at vger.kernel.org
Signed-off-by: Coly Li <colyli at suse.de>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(backported from commit dd0c91793b7c2658ea32c6b3a2247a8ceca45dc0)
[mfo: backport: request.c/hunk 1: insert blank line, refresh one context line.]
Signed-off-by: Mauricio Faria de Oliveira <mfo at canonical.com>
---
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);
}
--
2.17.1
More information about the kernel-team
mailing list