Skip to content

Commit

Permalink
bcache: fix ioctl in flash device
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
Tang Junhui authored and Jens Axboe committed Oct 8, 2018
1 parent 752f66a commit dd0c917
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions drivers/md/bcache/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 0 additions & 4 deletions drivers/md/bcache/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,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);
}
Expand Down

0 comments on commit dd0c917

Please sign in to comment.