Commit fc8183c1 authored by Jens Axboe's avatar Jens Axboe

[PATCH] scsi_ioctl reference counting

Now that we properly track queue references, that showed a bug in
scsi_ioctl.c, where it was dropping queues that it had never properly
gotten in the first place.
parent ace416a3
......@@ -406,26 +406,37 @@ int scsi_cmd_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long ar
if (!q)
return -ENXIO;
if (blk_get_queue(q))
return -ENXIO;
switch (cmd) {
/*
* new sgv3 interface
*/
case SG_GET_VERSION_NUM:
return sg_get_version((int *) arg);
err = sg_get_version((int *) arg);
break;
case SCSI_IOCTL_GET_IDLUN:
return scsi_get_idlun(q, (int *) arg);
err = scsi_get_idlun(q, (int *) arg);
break;
case SCSI_IOCTL_GET_BUS_NUMBER:
return scsi_get_bus(q, (int *) arg);
err = scsi_get_bus(q, (int *) arg);
break;
case SG_SET_TIMEOUT:
return sg_set_timeout(q, (int *) arg);
err = sg_set_timeout(q, (int *) arg);
break;
case SG_GET_TIMEOUT:
return sg_get_timeout(q);
err = sg_get_timeout(q);
break;
case SG_GET_RESERVED_SIZE:
return sg_get_reserved_size(q, (int *) arg);
err = sg_get_reserved_size(q, (int *) arg);
break;
case SG_SET_RESERVED_SIZE:
return sg_set_reserved_size(q, (int *) arg);
err = sg_set_reserved_size(q, (int *) arg);
break;
case SG_EMULATED_HOST:
return sg_emulated_host(q, (int *) arg);
err = sg_emulated_host(q, (int *) arg);
break;
case SG_IO:
err = bd_claim(bdev, current);
if (err)
......@@ -437,8 +448,9 @@ int scsi_cmd_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long ar
* old junk scsi send command ioctl
*/
case SCSI_IOCTL_SEND_COMMAND:
err = -EINVAL;
if (!arg)
return -EINVAL;
break;
err = bd_claim(bdev, current);
if (err)
......@@ -449,11 +461,6 @@ int scsi_cmd_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long ar
case CDROMCLOSETRAY:
close = 1;
case CDROMEJECT:
if (blk_get_queue(q)) {
err = -ENXIO;
break;
}
rq = blk_get_request(q, WRITE, __GFP_WAIT);
rq->flags |= REQ_BLOCK_PC;
rq->data = NULL;
......@@ -467,7 +474,7 @@ int scsi_cmd_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long ar
blk_put_request(rq);
break;
default:
return -ENOTTY;
err = -ENOTTY;
}
blk_put_queue(q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment