Skip to contentSkip to conversation

Patch for sd cleanup

PATCH Pete Zaitcev 2 participants 2 messages Feb 26, 2002 SCSI

lore
Share & tools
lore
#0 lore raw

Marcelo's 2.4.18 does not have this:

drivers/scsi/sd.c +2 -2
@@ -279,7 +279,7 @@
  	target = DEVICE_NR(dev);
 
 	dpnt = &rscsi_disks[target];
-	if (!dpnt)
+	if (!dpnt->device)
 		return NULL;	/* No such device */
 	return &dpnt->device->request_queue;
 }
@@ -302,7 +302,7 @@
 
 	dpnt = &rscsi_disks[dev];
 	if (devm >= (sd_template.dev_max << 4) ||
-	    !dpnt ||
+	    !dpnt->device ||
 	    !dpnt->device->online ||
  	    block + SCpnt->request.nr_sectors > sd[devm].nr_sects) {
 		SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", SCpnt->request.nr_sectors));

The subject was beaten to death on lists. The patch must go in. BTW, 2.5 has the same defect.

Since we are on the topic of sd.c cleanup, here's one more for you. I posted it before. Someone please try it out and let me know if anything interesting happens (say, slab area corruption :)

drivers/scsi/sd.c +5 -1
@@ -1412,10 +1412,14 @@
 		kfree(sd_blocksizes);
 		kfree(sd_hardsizes);
 		kfree((char *) sd);
+		for (i = 0; i < N_USED_SD_MAJORS; i++) {
+			kfree(sd_gendisks[i].de_arr);
+			kfree(sd_gendisks[i].flags);
+		}
 	}
 	for (i = 0; i < N_USED_SD_MAJORS; i++) {
 		del_gendisk(&sd_gendisks[i]);
-		blk_size[SD_MAJOR(i)] = NULL;
+		blksize_size[SD_MAJOR(i)] = NULL;
 		hardsect_size[SD_MAJOR(i)] = NULL;
 		read_ahead[SD_MAJOR(i)] = 0;
 	}

-- Pete

#1 lore raw

drivers/scsi/sd.c line 282

Quoted 10 lines

Marcelo's 2.4.18 does not have this:

drivers/scsi/sd.c +1 -1
@@ -279,7 +279,7 @@
  	target = DEVICE_NR(dev);
 
 	dpnt = &rscsi_disks[target];
-	if (!dpnt)
+	if (!dpnt->device)

In my pile Marcelo is about to get bombed with 8)