aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTang Junhui <tang.junhui.linux@gmail.com>2018-10-08 08:41:10 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-08 10:19:42 -0400
commitdd0c91793b7c2658ea32c6b3a2247a8ceca45dc0 (patch)
tree110f5bd2d12063e627654cbbd2aa24b2e94e2a42
parent752f66a75abad2ae40b4570b3c77b422389cffcf (diff)
bcache: fix ioctl in flash device
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>
-rw-r--r--drivers/md/bcache/request.c3
-rw-r--r--drivers/md/bcache/super.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index ee15fb039fd0..3bf35914bb57 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,
1218{ 1218{
1219 struct cached_dev *dc = container_of(d, struct cached_dev, disk); 1219 struct cached_dev *dc = container_of(d, struct cached_dev, disk);
1220 1220
1221 if (dc->io_disable)
1222 return -EIO;
1223
1221 return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); 1224 return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg);
1222} 1225}
1223 1226
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 5fd1466b34e4..9de6695195bf 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -648,10 +648,6 @@ static int ioctl_dev(struct block_device *b, fmode_t mode,
648 unsigned int cmd, unsigned long arg) 648 unsigned int cmd, unsigned long arg)
649{ 649{
650 struct bcache_device *d = b->bd_disk->private_data; 650 struct bcache_device *d = b->bd_disk->private_data;
651 struct cached_dev *dc = container_of(d, struct cached_dev, disk);
652
653 if (dc->io_disable)
654 return -EIO;
655 651
656 return d->ioctl(d, mode, cmd, arg); 652 return d->ioctl(d, mode, cmd, arg);
657} 653}