linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] Make errors printed from scsi_sysfs_add_sdev() mean something.
Date: Mon, 12 Jan 2009 15:04:26 +0100	[thread overview]
Message-ID: <496B4DEA.9000206@suse.de> (raw)
In-Reply-To: <496B4067.1020204@s5r6.in-berlin.de>

Hi Stefan,

Stefan Richter wrote:
> Hannes Reinecke wrote:
>> Michał Mirosław wrote:
>>> --- a/drivers/scsi/scsi_sysfs.c
>>> +++ b/drivers/scsi/scsi_sysfs.c
>>> @@ -872,12 +872,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
>>>  	error = device_add(&sdev->sdev_gendev);
>>>  	if (error) {
>>>  		put_device(sdev->sdev_gendev.parent);
>>> -		printk(KERN_INFO "error 1\n");
>>> +		printk(KERN_ERR "sysfs: SCSI device registration failed: %d\n", error);
>> Shouldn't that be sdev_printk()?
> 
> It seems it shouldn't.  sdev_printk() wants device name and bus ID of
> the sdev_gendev.  AFAICS device_add() initializes them, and callers of
> device_add() can't be quite sure how far device_add() got before an error.
> 
Hmm. True.

Easiest way would be to remove the printk altogether, as a failure of
device_add() will print out enough warnings as it stands.
To be precise you get something like

------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:463 sysfs_add_one+0x33/0x3a()
sysfs: duplicate filename '4:0:1:0' can not be created
...
---[ end trace dac6dbc3f072e760 ]---

and

kobject_add_internal failed for 4:0:1:0 with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 2693, comm: scsi_wq_4 Tainted: G        W 2.6.27.10-20090109 #2
...

so we have enough information already.

>>>  		return error;
>>>  	}
>>>  	error = device_add(&sdev->sdev_dev);
>>>  	if (error) {
>>> -		printk(KERN_INFO "error 2\n");
>>> +		printk(KERN_ERR "sysfs: SCSI class device registration failed: %d\n", error);
>> Same here ...
> 
> At that point, sdev_printk() should work indeed.
But it'll spawn a similar error as above, so we
could remove it here, too.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2009-01-12 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 22:19 [PATCH] Make errors printed from scsi_sysfs_add_sdev() mean something Michał Mirosław
2009-01-12 12:30 ` Hannes Reinecke
2009-01-12 13:06   ` Stefan Richter
2009-01-12 14:04     ` Hannes Reinecke [this message]

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=496B4DEA.9000206@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --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;
as well as URLs for NNTP newsgroup(s).