Commit 5cdeb2cc authored by Alexander Viro's avatar Alexander Viro Committed by James Bottomley

[PATCH] dasd fixes

parent eaa0bfbd
...@@ -337,11 +337,6 @@ dasd_state_known_to_new(dasd_device_t * device) ...@@ -337,11 +337,6 @@ dasd_state_known_to_new(dasd_device_t * device)
/* Forget the discipline information. */ /* Forget the discipline information. */
device->discipline = NULL; device->discipline = NULL;
device->state = DASD_STATE_NEW; device->state = DASD_STATE_NEW;
/* Forget the block device */
bdev = bdget(MKDEV(device->gdp->major, device->gdp->first_minor));
bdput(bdev);
bdput(bdev);
} }
/* /*
......
...@@ -88,33 +88,17 @@ int ...@@ -88,33 +88,17 @@ int
dasd_ioctl(struct inode *inp, struct file *filp, dasd_ioctl(struct inode *inp, struct file *filp,
unsigned int no, unsigned long data) unsigned int no, unsigned long data)
{ {
dasd_devmap_t *devmap; struct block_device *bdev = inp->i_bdev;
dasd_device_t *device; dasd_device_t *device = bdev->bd_disk->private_data;
dasd_ioctl_list_t *ioctl; dasd_ioctl_list_t *ioctl;
struct block_device *bdev;
struct list_head *l; struct list_head *l;
const char *dir; const char *dir;
int rc; int rc;
if ((!inp) || kdev_none(inp->i_rdev))
return -EINVAL;
if ((_IOC_DIR(no) != _IOC_NONE) && (data == 0)) { if ((_IOC_DIR(no) != _IOC_NONE) && (data == 0)) {
PRINT_DEBUG("empty data ptr"); PRINT_DEBUG("empty data ptr");
return -EINVAL; return -EINVAL;
} }
bdev = bdget(kdev_t_to_nr(inp->i_rdev));
if (!bdev)
return -EINVAL;
devmap = dasd_devmap_from_bdev(bdev);
device = (devmap != NULL) ?
dasd_get_device(devmap) : ERR_PTR(-ENODEV);
if (IS_ERR(device)) {
MESSAGE(KERN_WARNING,
"No device registered as device %s", bdevname(bdev));
bdput(bdev);
return -EINVAL;
}
dir = _IOC_DIR (no) == _IOC_NONE ? "0" : dir = _IOC_DIR (no) == _IOC_NONE ? "0" :
_IOC_DIR (no) == _IOC_READ ? "r" : _IOC_DIR (no) == _IOC_READ ? "r" :
_IOC_DIR (no) == _IOC_WRITE ? "w" : _IOC_DIR (no) == _IOC_WRITE ? "w" :
...@@ -134,8 +118,6 @@ dasd_ioctl(struct inode *inp, struct file *filp, ...@@ -134,8 +118,6 @@ dasd_ioctl(struct inode *inp, struct file *filp,
__MOD_DEC_USE_COUNT(ioctl->owner); __MOD_DEC_USE_COUNT(ioctl->owner);
} else } else
rc = ioctl->handler(bdev, no, data); rc = ioctl->handler(bdev, no, data);
dasd_put_device(devmap);
bdput(bdev);
return rc; return rc;
} }
} }
...@@ -143,8 +125,6 @@ dasd_ioctl(struct inode *inp, struct file *filp, ...@@ -143,8 +125,6 @@ dasd_ioctl(struct inode *inp, struct file *filp,
DBF_DEV_EVENT(DBF_INFO, device, DBF_DEV_EVENT(DBF_INFO, device,
"unknown ioctl 0x%08x=%s'0x%x'%d(%d) data %8lx", no, "unknown ioctl 0x%08x=%s'0x%x'%d(%d) data %8lx", no,
dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data); dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data);
dasd_put_device(devmap);
bdput(bdev);
return -ENOTTY; return -ENOTTY;
} }
......
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