From: Christoph Hellwig <hch@infradead.org>
To: James.Smart@Emulex.Com
Cc: hch@infradead.org, linux-scsi@vger.kernel.org
Subject: Re: [Patch] Correct issue with midlayer scsi target allocation and transports that create the targets
Date: Sat, 11 Jun 2005 16:37:45 +0100 [thread overview]
Message-ID: <20050611153745.GA31943@infradead.org> (raw)
In-Reply-To: <9BB4DECD4CFE6D43AA8EA8D768ED51C201AC72@xbl3.ad.emulex.com>
> diff -upNr linux-2.6.12-rc6/drivers/scsi/scsi_scan.c linux-2.6.12-rc6.PATCHED/drivers/scsi/scsi_scan.c
> --- linux-2.6.12-rc6/drivers/scsi/scsi_scan.c 2005-06-09 15:58:31.000000000 -0400
> +++ linux-2.6.12-rc6.PATCHED/drivers/scsi/scsi_scan.c 2005-06-10 16:11:04.000000000 -0400
> @@ -332,9 +332,23 @@ static struct scsi_target *scsi_alloc_ta
> unsigned long flags;
> const int size = sizeof(struct scsi_target)
> + shost->transportt->target_size;
> - struct scsi_target *starget = kmalloc(size, GFP_ATOMIC);
> + struct scsi_target *starget;
> struct scsi_target *found_target;
>
> + /*
> + * Obtain the real parent from the transport. The transport
> + * is allowed to fail (no error) if there is nothing at that
> + * target id.
> + */
> + if (shost->transportt->target_parent) {
> + spin_lock_irqsave(shost->host_lock, flags);
> + parent = shost->transportt->target_parent(shost, channel, id);
> + spin_unlock_irqrestore(shost->host_lock, flags);
> + if (!parent)
> + return NULL;
> + }
Ok, this idea is a lot better, but I think scsi_alloc_target is still
the wrong place to put this. It has an explicit parent argument that
all but one of it's callers get right, and we're now totally ignoring
and looking it up again when the transport has a ->target_parent method.
I'm not totally sure where the right place to put it in the
scsi_scan_host_selected path is, though. Probably scsi_scan_host_selected
shoud just become __scsi_scan_host_selected, scsi_scan_host would call
it directly but the sysfs and legacy procfs scanning would call the method.
Or it might be better to give the transport completely control over the
scan sysfs attribute, that way we could even allow scanning by WWNs or
similar things.
next prev parent reply other threads:[~2005-06-11 15:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-11 2:24 [Patch] Correct issue with midlayer scsi target allocation and transports that create the targets James.Smart
2005-06-11 15:37 ` Christoph Hellwig [this message]
2005-06-11 18:15 ` Patrick Mansfield
2005-06-11 18:18 ` Christoph Hellwig
2005-06-14 22:17 ` [Patch] take 4: " Patrick Mansfield
2005-06-14 22:35 ` Christoph Hellwig
2005-06-14 22:54 ` Patrick Mansfield
2005-06-17 11:11 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2005-06-10 19:03 [Patch] " James.Smart
2005-06-10 20:25 ` Christoph Hellwig
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=20050611153745.GA31943@infradead.org \
--to=hch@infradead.org \
--cc=James.Smart@Emulex.Com \
--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