Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tang Junhui and committed by
Jens Axboe
dd0c9179 752f66a7

+3 -4
+3
drivers/md/bcache/request.c
··· 1218 1218 { 1219 1219 struct cached_dev *dc = container_of(d, struct cached_dev, disk); 1220 1220 1221 + if (dc->io_disable) 1222 + return -EIO; 1223 + 1221 1224 return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); 1222 1225 } 1223 1226
-4
drivers/md/bcache/super.c
··· 648 648 unsigned int cmd, unsigned long arg) 649 649 { 650 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 652 return d->ioctl(d, mode, cmd, arg); 657 653 }