From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] Skip deleted devices in __scsi_device_lookup_by_target()
Date: Tue, 13 Jan 2009 16:50:37 +0100 [thread overview]
Message-ID: <496CB84D.3090806@suse.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]
Hi all,
this is a modified patch of my earlier patch
'Restart scsi_device_lookup_by_target'.
After discussions with Matthew Wilcox and James B. it
turned out that it's actually better to skip deleted
devices from __scsi_device_lookup_by_target(), leaving
scsi_device_lookup_by_target() untouched.
So here it goes.
James, please apply.
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)
[-- Attachment #2: scsi-restart-lookup-by-target --]
[-- Type: text/plain, Size: 1474 bytes --]
Skip deleted devices in __scsi_device_lookup_by_target()
__scsi_device_lookup_by_target() will always return
the first sdev with a matching LUN, regardless of
the state. However, when this sdev is in SDEV_DEL
scsi_device_lookup_by_target() will ignore this
device and so any valid device on the list after
the deleted device will never be found.
So we have to modify __scsi_device_lookup_by_target()
to skip any device in SDEV_DEL.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index f8b79d4..537bb92 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1099,7 +1099,8 @@ EXPORT_SYMBOL(__starget_for_each_device);
* Description: Looks up the scsi_device with the specified @lun for a given
* @starget. The returned scsi_device does not have an additional
* reference. You must hold the host's host_lock over this call and
- * any access to the returned scsi_device.
+ * any access to the returned scsi_device. A scsi_device in state
+ * SDEV_DEL is skipped.
*
* Note: The only reason why drivers should use this is because
* they need to access the device list in irq context. Otherwise you
@@ -1111,6 +1112,8 @@ struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
struct scsi_device *sdev;
list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
+ if (sdev->sdev_state == SDEV_DEL)
+ continue;
if (sdev->lun ==lun)
return sdev;
}
reply other threads:[~2009-01-13 15:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=496CB84D.3090806@suse.de \
--to=hare@suse.de \
--cc=James.Bottomley@HansenPartnership.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.