mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
nbd: ignore non-nbd ioctl's
In testing we noticed that nbd would spew if you ran a fio job against the raw device itself. This is because fio calls a block device specific ioctl, however the block layer will first pass this back to the driver ioctl handler in case the driver wants to do something special. Since the device was setup using netlink this caused us to spew every time fio called this ioctl. Since we don't have special handling, just error out for any non-nbd specific ioctl's that come in. This fixes the spew. Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f507b54dcc
commit
1dae69bede
1 changed files with 6 additions and 0 deletions
|
@ -1194,6 +1194,12 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
/* The block layer will pass back some non-nbd ioctls in case we have
|
||||||
|
* special handling for them, but we don't so just return an error.
|
||||||
|
*/
|
||||||
|
if (_IOC_TYPE(cmd) != 0xab)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&nbd->config_lock);
|
mutex_lock(&nbd->config_lock);
|
||||||
|
|
||||||
/* Don't allow ioctl operations on a nbd device that was created with
|
/* Don't allow ioctl operations on a nbd device that was created with
|
||||||
|
|
Loading…
Reference in a new issue