Index: 2.6.23/block/genhd.c =================================================================== --- 2.6.23.orig/block/genhd.c +++ 2.6.23/block/genhd.c @@ -496,6 +496,7 @@ static void disk_release(struct device * { struct gendisk *disk = dev_to_disk(dev); + printk(KERN_INFO "disk_release: kobj %p\n", &disk->dev.kobj); kfree(disk->random); kfree(disk->part); free_disk_stats(disk); Index: 2.6.23/block/ll_rw_blk.c =================================================================== --- 2.6.23.orig/block/ll_rw_blk.c +++ 2.6.23/block/ll_rw_blk.c @@ -1781,6 +1781,8 @@ static void blk_release_queue(struct kob container_of(kobj, struct request_queue, kobj); struct request_list *rl = &q->rq; + printk(KERN_INFO "blk_release_queue: rq %p, parent %p\n", + q, q->kobj.parent); blk_sync_queue(q); if (rl->rq_pool) Index: 2.6.23/drivers/scsi/scsi_sysfs.c =================================================================== --- 2.6.23.orig/drivers/scsi/scsi_sysfs.c +++ 2.6.23/drivers/scsi/scsi_sysfs.c @@ -238,6 +238,8 @@ static void scsi_device_dev_release_user list_del(&sdev->starved_entry); spin_unlock_irqrestore(sdev->host->host_lock, flags); + printk(KERN_INFO "scsi_device_dev_release: rq %p\n", + sdev->request_queue); if (sdev->request_queue) { sdev->request_queue->queuedata = NULL; /* user context needed to free queue */ Index: 2.6.23/fs/partitions/check.c =================================================================== --- 2.6.23.orig/fs/partitions/check.c +++ 2.6.23/fs/partitions/check.c @@ -516,5 +516,9 @@ void del_gendisk(struct gendisk *disk) sysfs_remove_link(&block_depr, disk->dev.bus_id); #endif device_del(&disk->dev); - put_device(&disk->dev); + printk(KERN_INFO "del_gendisk %s, kobj %p, queue %p, " + "refcount before put_device %d\n", + disk->dev.bus_id, &disk->dev.kobj, disk->queue, + atomic_read(&disk->dev.kobj.kref.refcount)); +// put_device(&disk->dev); } Index: 2.6.23/drivers/scsi/sd.c =================================================================== --- 2.6.23.orig/drivers/scsi/sd.c +++ 2.6.23/drivers/scsi/sd.c @@ -1738,6 +1738,10 @@ static void scsi_disk_release(struct cla spin_unlock(&sd_index_lock); disk->private_data = NULL; + printk(KERN_INFO "scsi_disk_release: disk %s, kobj %p, " + "refcount before put_disk %d\n", + disk->dev.bus_id, &disk->dev.kobj, + atomic_read(&disk->dev.kobj.kref.refcount)); put_disk(disk); put_device(&sdkp->device->sdev_gendev);