Skip to content

Commit 32870e2

Browse files
Tang Junhuigregkh
authored andcommitted
bcache: fix ioctl in flash device
commit dd0c917 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: 0f0709e ("bcache: stop bcache device when backing device is offline") Signed-off-by: Tang Junhui <[email protected]> Cc: [email protected] Signed-off-by: Coly Li <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent fec039e commit 32870e2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

drivers/md/bcache/request.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,9 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode,
12181218
{
12191219
struct cached_dev *dc = container_of(d, struct cached_dev, disk);
12201220

1221+
if (dc->io_disable)
1222+
return -EIO;
1223+
12211224
return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg);
12221225
}
12231226

drivers/md/bcache/super.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,6 @@ static int ioctl_dev(struct block_device *b, fmode_t mode,
643643
unsigned int cmd, unsigned long arg)
644644
{
645645
struct bcache_device *d = b->bd_disk->private_data;
646-
struct cached_dev *dc = container_of(d, struct cached_dev, disk);
647-
648-
if (dc->io_disable)
649-
return -EIO;
650646

651647
return d->ioctl(d, mode, cmd, arg);
652648
}

0 commit comments

Comments
 (0)