]> err.no Git - linux-2.6/blobdiff - drivers/block/pktcdvd.c
Automatic merge of /spare/repo/netdev-2.6 branch ixgb
[linux-2.6] / drivers / block / pktcdvd.c
index 82ccad0a7f1a48e56b4d36a628b56aea5392166e..bc56770bcc90889338810134bba163530e9f72d1 100644 (file)
@@ -914,8 +914,10 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
                bio = node->bio;
                zone = ZONE(bio->bi_sector, pd);
                list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) {
-                       if (p->sector == zone)
+                       if (p->sector == zone) {
+                               bio = NULL;
                                goto try_next_bio;
+                       }
                }
                break;
 try_next_bio:
@@ -2019,7 +2021,13 @@ static int pkt_open(struct inode *inode, struct file *file)
        BUG_ON(pd->refcnt < 0);
 
        pd->refcnt++;
-       if (pd->refcnt == 1) {
+       if (pd->refcnt > 1) {
+               if ((file->f_mode & FMODE_WRITE) &&
+                   !test_bit(PACKET_WRITABLE, &pd->flags)) {
+                       ret = -EBUSY;
+                       goto out_dec;
+               }
+       } else {
                if (pkt_open_dev(pd, file->f_mode & FMODE_WRITE)) {
                        ret = -EIO;
                        goto out_dec;