diff options
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r-- | drivers/block/pktcdvd.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 1a1fa3ccb913..bc56770bcc90 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -914,8 +914,10 @@ static int pkt_handle_queue(struct pktcdvd_device *pd) | |||
914 | bio = node->bio; | 914 | bio = node->bio; |
915 | zone = ZONE(bio->bi_sector, pd); | 915 | zone = ZONE(bio->bi_sector, pd); |
916 | list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) { | 916 | list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) { |
917 | if (p->sector == zone) | 917 | if (p->sector == zone) { |
918 | bio = NULL; | ||
918 | goto try_next_bio; | 919 | goto try_next_bio; |
920 | } | ||
919 | } | 921 | } |
920 | break; | 922 | break; |
921 | try_next_bio: | 923 | try_next_bio: |
@@ -2019,7 +2021,13 @@ static int pkt_open(struct inode *inode, struct file *file) | |||
2019 | BUG_ON(pd->refcnt < 0); | 2021 | BUG_ON(pd->refcnt < 0); |
2020 | 2022 | ||
2021 | pd->refcnt++; | 2023 | pd->refcnt++; |
2022 | if (pd->refcnt == 1) { | 2024 | if (pd->refcnt > 1) { |
2025 | if ((file->f_mode & FMODE_WRITE) && | ||
2026 | !test_bit(PACKET_WRITABLE, &pd->flags)) { | ||
2027 | ret = -EBUSY; | ||
2028 | goto out_dec; | ||
2029 | } | ||
2030 | } else { | ||
2023 | if (pkt_open_dev(pd, file->f_mode & FMODE_WRITE)) { | 2031 | if (pkt_open_dev(pd, file->f_mode & FMODE_WRITE)) { |
2024 | ret = -EIO; | 2032 | ret = -EIO; |
2025 | goto out_dec; | 2033 | goto out_dec; |
@@ -2406,7 +2414,7 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
2406 | case CDROM_LAST_WRITTEN: | 2414 | case CDROM_LAST_WRITTEN: |
2407 | case CDROM_SEND_PACKET: | 2415 | case CDROM_SEND_PACKET: |
2408 | case SCSI_IOCTL_SEND_COMMAND: | 2416 | case SCSI_IOCTL_SEND_COMMAND: |
2409 | return ioctl_by_bdev(pd->bdev, cmd, arg); | 2417 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2410 | 2418 | ||
2411 | case CDROMEJECT: | 2419 | case CDROMEJECT: |
2412 | /* | 2420 | /* |
@@ -2414,7 +2422,7 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
2414 | * have to unlock it or else the eject command fails. | 2422 | * have to unlock it or else the eject command fails. |
2415 | */ | 2423 | */ |
2416 | pkt_lock_door(pd, 0); | 2424 | pkt_lock_door(pd, 0); |
2417 | return ioctl_by_bdev(pd->bdev, cmd, arg); | 2425 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2418 | 2426 | ||
2419 | default: | 2427 | default: |
2420 | printk("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd); | 2428 | printk("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd); |