linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Patch for sd cleanup
Date: Mon, 25 Feb 2002 20:22:55 -0500	[thread overview]
Message-ID: <20020225202255.A3526@devserv.devel.redhat.com> (raw)

Marcelo's 2.4.18 does not have this:

--- linux-2.4.18/drivers/scsi/sd.c	Mon Feb 25 11:38:04 2002
+++ linux-2.4.18-p3/drivers/scsi/sd.c	Mon Feb 25 17:09:59 2002
@@ -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 :)

--- linux-2.4.18/drivers/scsi/sd.c	Mon Feb 25 11:38:04 2002
+++ linux-2.4.18-p3/drivers/scsi/sd.c	Mon Feb 25 17:09:59 2002
@@ -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

             reply	other threads:[~2002-02-26  1:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-26  1:22 Pete Zaitcev [this message]
2002-02-26  1:41 ` Patch for sd cleanup Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020225202255.A3526@devserv.devel.redhat.com \
    --to=zaitcev@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).