public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandra Seetharaman <sekharan@us.ibm.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Konrad Rzeszutek <konrad@virtualiron.com>,
	linux-scsi@vger.kernel.org, pjones@redhat.com,
	michaelc@cs.wisc.edu, James.Bottomley@HansenPartnership.com
Subject: Re: [PATCH 2/3] scsi_dh: Change scsi device handler modules to	utilize modalias
Date: Wed, 18 Mar 2009 10:25:58 -0700	[thread overview]
Message-ID: <1237397158.14147.3.camel@chandra-ubuntu> (raw)
In-Reply-To: <49C1168F.6060900@s5r6.in-berlin.de>


On Wed, 2009-03-18 at 16:43 +0100, Stefan Richter wrote:
> Konrad Rzeszutek wrote:
> > .. snip..
> >> +	{TYPE_ANY, "HP", "HSV300" },
> >> +	{TYPE_ANY, "IBM", "2107900" },
> >> +	{TYPE_ANY, "IBM", "2145" },
> >> +	{TYPE_ANY, "Pillar", "Axiom" },
> >> +	{0, "", ""},
> > 
> > Is there a define for '0' value?
> 
> This is an array terminator.  Almost nobody uses cpp defines for
> terminating values.  (In this case, the actual terminator is "" in the
> 2nd struct member.)
> 
> BTW, Peter,
> 
> >> --- linux-2.6.28.orig/drivers/scsi/device_handler/scsi_dh.c
> >> +++ linux-2.6.28/drivers/scsi/device_handler/scsi_dh.c
> >> @@ -75,7 +75,10 @@ static int scsi_dh_handler_lookup(struct
> >>  {
> >>  	int i, found = 0;
> >>  
> >> -	for(i = 0; scsi_dh->devlist[i].vendor; i++) {
> >> +	for(i = 0; scsi_dh->devlist[i].vendor[0]; i++) {
> >> +		if ((scsi_dh->devlist[i].type != TYPE_ANY) &&
> >> +				(scsi_dh->devlist[i].type != sdev->type))
> >> +			continue;
> >>  		if (!strncmp(sdev->vendor, scsi_dh->devlist[i].vendor,
> >>  			     strlen(scsi_dh->devlist[i].vendor)) &&
> >>  		    !strncmp(sdev->model, scsi_dh->devlist[i].model,
> 
> AFAICS you could have kept the check for .vendor != NULL instead of
> .vendor[0] != '\0' and write the terminator thusly:
> 
> 	{},
> 
> Saves the space for a one byte long string in the object files.  :-)

Tried it after your response. Got a panic :(.

Did I code your suggestion correctly ?

Here is the patch
--------------
Index: linux-2.6.29-rc8/drivers/scsi/device_handler/scsi_dh.c
===================================================================
--- linux-2.6.29-rc8.orig/drivers/scsi/device_handler/scsi_dh.c
+++ linux-2.6.29-rc8/drivers/scsi/device_handler/scsi_dh.c
@@ -75,7 +75,7 @@ static int scsi_dh_handler_lookup(struct
 {
        int i, found = 0;
 
-       for(i = 0; scsi_dh->devlist[i].vendor[0]; i++) {
+       for(i = 0; scsi_dh->devlist[i].vendor; i++) {
                if ((scsi_dh->devlist[i].type != TYPE_ANY) &&
                                (scsi_dh->devlist[i].type !=
sdev->type))
                        continue;
Index: linux-2.6.29-rc8/drivers/scsi/device_handler/scsi_dh_rdac.c
===================================================================
--- linux-2.6.29-rc8.orig/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ linux-2.6.29-rc8/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -604,7 +604,7 @@ static const struct scsi_dh_device_id rd
        {TYPE_ANY, "DELL", "MD3000i"},
        {TYPE_ANY, "LSI", "INF-01-00"},
        {TYPE_ANY, "ENGENIO", "INF-01-00"},
-       {0, "", ""},
+       {},
 };
 
 MODULE_DEVICE_TABLE(scsi_dh, rdac_dev_list);
--------------
Here is the panic
--------------

Faulting instruction address: 0xd0000000017e01c4
cpu 0x0: Vector: 300 (Data Access) at [c0000000e2fbb680]
    pc: d0000000017e01c4: .scsi_dh_handler_lookup+0x24/0xc0 [scsi_dh]
    lr: d0000000017e0200: .scsi_dh_handler_lookup+0x60/0xc0 [scsi_dh]
    sp: c0000000e2fbb900
   msr: 8000000000009032
   dar: d000000002f80017
 dsisr: 40000000
  current = 0xc0000000e7a84200
  paca    = 0xc000000000723400
    pid   = 3516, comm = modprobe
enter ? for help
[c0000000e2fbb900] c0000000e2fbb9e0 (unreliable)
[c0000000e2fbb9a0] d0000000017e0604 .device_handler_match+0x110/0x278
[scsi_dh]
[c0000000e2fbba50] d0000000017e0bd0 .scsi_dh_notifier_add+0x54/0x94
[scsi_dh]
[c0000000e2fbbae0] c0000000002d9d40 .bus_for_each_dev+0x80/0xd8
[c0000000e2fbbb90] d0000000017e0dc0 .scsi_register_device_handler
+0x90/0xcc [scsi_dh]
[c0000000e2fbbc20] d000000002f70ce8 .rdac_init+0x20/0x4d8 [scsi_dh_rdac]
[c0000000e2fbbca0] c0000000000090b0 .do_one_initcall+0x90/0x1a8
[c0000000e2fbbd90] c0000000000a0b28 .SyS_init_module+0xc4/0x214
[c0000000e2fbbe30] c000000000008534 syscall_exit+0x0/0x40
--- Exception: c00 (System Call) at 000000000ff11a6c
SP (ffb6f7e0) is in userspace
0:mon> 



  reply	other threads:[~2009-03-18 17:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18  1:36 [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Chandra Seetharaman
2009-03-18  1:36 ` [PATCH 1/3] scsi_dh: Add modalias support for SCSI targets Chandra Seetharaman
2009-03-18 13:44   ` Konrad Rzeszutek
2009-03-18 14:02     ` James Bottomley
2009-03-18 14:36       ` Konrad Rzeszutek
2009-03-18 18:30   ` Kay Sievers
2009-03-18 19:18     ` Chandra Seetharaman
2009-03-19 18:54       ` Chandra Seetharaman
2009-03-20 18:24         ` Peter Jones
2009-03-23 22:13           ` Chandra Seetharaman
2009-04-03 22:43             ` Chandra Seetharaman
2009-04-07 20:59               ` James Bottomley
2009-04-07 23:41                 ` Chandra Seetharaman
2009-04-08 15:08                 ` Peter Jones
2009-04-15 21:52                   ` Chandra Seetharaman
2009-04-16 15:18                     ` Hannes Reinecke
2009-04-07 23:22               ` Hannes Reinecke
2009-04-07 23:50                 ` Chandra Seetharaman
2009-04-08  5:15                   ` Kay Sievers
2009-04-08 19:13                     ` Chandra Seetharaman
2009-03-18 18:47   ` James Bottomley
2009-03-18 19:12     ` Chandra Seetharaman
2009-03-18 20:09       ` James Bottomley
2009-03-18 20:24         ` Kay Sievers
2009-03-18 20:26           ` James Bottomley
2009-03-18 20:59         ` Chandra Seetharaman
2009-03-20 17:41         ` Peter Jones
2009-03-18  1:36 ` [PATCH 2/3] scsi_dh: Change scsi device handler modules to utilize modalias Chandra Seetharaman
2009-03-18 13:46   ` Konrad Rzeszutek
2009-03-18 15:43     ` Stefan Richter
2009-03-18 17:25       ` Chandra Seetharaman [this message]
2009-03-18 17:50         ` Stefan Richter
2009-03-18 18:18           ` Kay Sievers
2009-03-18 19:44             ` Stefan Richter
2009-03-18 18:50           ` Chandra Seetharaman
2009-03-18 19:46             ` Stefan Richter
2009-03-18  1:36 ` [PATCH 3/3] scsi_dh: Workaround a race condition in module insertion Chandra Seetharaman
2009-03-18 11:31 ` [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2009-04-27 18:06 Chandra Seetharaman
2009-04-27 18:06 ` [PATCH 2/3] scsi_dh: Change scsi device handler modules to utilize modalias Chandra Seetharaman

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=1237397158.14147.3.camel@chandra-ubuntu \
    --to=sekharan@us.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=konrad@virtualiron.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=pjones@redhat.com \
    --cc=sekharan@linux.vnet.ibm.com \
    --cc=stefanr@s5r6.in-berlin.de \
    /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