From: James Bottomley <James.Bottomley@SteelEye.com>
To: Hannes Reinecke <hare@suse.de>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix reference counting for failed SCSI devices
Date: Tue, 24 May 2005 17:57:58 -0500 [thread overview]
Message-ID: <1116975478.7710.28.camel@mulgrave> (raw)
In-Reply-To: <4292F631.9090300@suse.de>
On Tue, 2005-05-24 at 11:38 +0200, Hannes Reinecke wrote:
> whenever the scsi-ml tries to scan non-existent devices the reference
> count in scsi_alloc_sdev() and scsi_probe_and_add_lun() is not adjusted
> properly. Every call to XXX_initialize in the driver core sets the
> reference count to 1, so for a proper deallocation an explicit XXX_put()
> has to be done.
That's true, but I don't see what the problem is if the device has never
been made visible.
> + put_device(&starget->dev);
this would amount to a double put, since the parent put method is called
in the device release.
> + class_device_put(&sdev->sdev_classdev);
This is unnecessary since the class device is simply occupying a private
area in the scsi_device. As long as its never made visible to the
system, its refcount is irrelevant
> put_device(&sdev->sdev_gendev);
> out:
> if (display_failure_msg)
> @@ -855,6 +857,8 @@ static int scsi_probe_and_add_lun(struct
> if (sdev->host->hostt->slave_destroy)
> sdev->host->hostt->slave_destroy(sdev);
> transport_destroy_device(&sdev->sdev_gendev);
> + class_device_put(&sdev->sdev_classdev);
> + put_device(sdev->sdev_gendev.parent);
same should apply here. As long as this cascade occurs before
scsi_add_lun() (which calls scsi_sysfs_add_sdev()), which is what makes
the whole set of devices and classes visible.
James
next prev parent reply other threads:[~2005-05-24 22:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-24 9:38 [PATCH] Fix reference counting for failed SCSI devices Hannes Reinecke
2005-05-24 22:57 ` James Bottomley [this message]
2005-05-25 6:50 ` Hannes Reinecke
2005-05-25 12:27 ` James Bottomley
2005-05-25 12:46 ` Hannes Reinecke
2005-05-25 14:58 ` James Bottomley
2005-05-25 15:16 ` Hannes Reinecke
2005-05-25 17:51 ` James Bottomley
2005-05-25 18:01 ` Matthew Wilcox
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=1116975478.7710.28.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=hare@suse.de \
--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