}
        }
        h->drv[drv_index].LunID = lunid;
-       if (cciss_create_ld_sysfs_entry(h, drv_index))
-               goto err_free_disk;
-
+       if (h->drv[drv_index].dev == NULL) {
+               if (cciss_create_ld_sysfs_entry(h, drv_index))
+                       goto err_free_disk;
+       }
        /* Don't need to mark this busy because nobody */
        /* else knows about this disk yet to contend */
        /* for access to it. */
         */
        if (h->gendisk[0] != disk) {
                struct request_queue *q = disk->queue;
-               if (disk->flags & GENHD_FL_UP)
+               if (disk->flags & GENHD_FL_UP) {
+                       cciss_destroy_ld_sysfs_entry(h, drv_index);
                        del_gendisk(disk);
+               }
                if (q) {
                        blk_cleanup_queue(q);
                        /* Set drv->queue to NULL so that we do not try
                                 * indicate that this element of the drive
                                 * array is free.
                                 */
-       cciss_destroy_ld_sysfs_entry(h, drv_index);
 
        if (clear_all) {
                /* check to see if it was the last disk */
                if (disk) {
                        struct request_queue *q = disk->queue;
 
-                       if (disk->flags & GENHD_FL_UP)
+                       if (disk->flags & GENHD_FL_UP) {
+                               cciss_destroy_ld_sysfs_entry(hba[i], j);
                                del_gendisk(disk);
+                       }
                        if (q)
                                blk_cleanup_queue(q);
                }
-               if (hba[i]->drv[j].dev != NULL &&
-                       (j == 0 || hba[i]->drv[j].raid_level != -1))
-                               cciss_destroy_ld_sysfs_entry(hba[i], j);
-
        }
 
 #ifdef CONFIG_CISS_SCSI_TAPE