From: Chandra Seetharaman <sekharan@us.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: pjones@redhat.com, michaelc@cs.wisc.edu,
James.Bottomley@HansenPartnership.com, hare@suse.de,
Chandra Seetharaman <sekharan@us.ibm.com>
Subject: [PATCH 3/3] scsi_dh: Workaround a race condition in module insertion
Date: Mon, 27 Apr 2009 11:06:27 -0700 [thread overview]
Message-ID: <20090427180627.22758.59210.sendpatchset@chandra-ubuntu> (raw)
In-Reply-To: <20090427180609.22758.93035.sendpatchset@chandra-ubuntu>
From: Chandra Seetharaman <sekharan@us.ibm.com>
scsi_dh module is getting inserted as soon as the first device is seen.
But, the first device is not seen by the module as we were past the
ADD_DEVICE handling in the module.
Catch the first device by handling BUS_NOTIFY_BOUND_DRIVER event,
and not handle that event for any of the future devices (as they would
have been handled by ADD_DEVICE event).
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
---
drivers/scsi/device_handler/scsi_dh.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Index: linux-2.6.29/drivers/scsi/device_handler/scsi_dh.c
===================================================================
--- linux-2.6.29.orig/drivers/scsi/device_handler/scsi_dh.c
+++ linux-2.6.29/drivers/scsi/device_handler/scsi_dh.c
@@ -294,7 +294,16 @@ static int scsi_dh_notifier(struct notif
sdev = to_scsi_device(dev);
- if (action == BUS_NOTIFY_ADD_DEVICE) {
+ if ((action == BUS_NOTIFY_ADD_DEVICE) ||
+ (action == BUS_NOTIFY_BOUND_DRIVER)) {
+ /*
+ * This can happen if device was configured already
+ * with BUS_NOTIFY_ADD_DEVICE and we are called
+ * now with BUS_NOTIFY_BOUND_DRIVER
+ */
+ if (sdev->scsi_dh_data)
+ goto out;
+
devinfo = device_handler_match(NULL, sdev);
if (!devinfo)
goto out;
next prev parent reply other threads:[~2009-04-27 18:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 18:06 [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Chandra Seetharaman
2009-04-27 18:06 ` [PATCH 1/3] scsi_dh: Add modalias support for SCSI targets Chandra Seetharaman
2009-04-27 18:06 ` [PATCH 2/3] scsi_dh: Change scsi device handler modules to utilize modalias Chandra Seetharaman
2009-04-27 18:06 ` Chandra Seetharaman [this message]
2009-06-15 18:29 ` [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Peter Jones
2009-06-15 23:14 ` Chandra Seetharaman
2009-06-18 22:48 ` James Bottomley
2009-06-19 18:58 ` Peter Jones
2009-06-26 13:56 ` Peter Jones
2009-07-07 17:12 ` James Bottomley
2009-07-07 17:51 ` Peter Jones
2009-07-07 18:14 ` James Bottomley
2009-07-07 19:36 ` Chandra Seetharaman
2009-07-08 15:53 ` [PATCH 0/3] scsi_dh: Make scsi device handler modulesautomatically inserted berthiaume_wayne
2009-07-08 18:28 ` Chandra Seetharaman
2009-07-08 15:58 ` [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Christoph Hellwig
2009-07-08 18:21 ` Chandra Seetharaman
2009-07-08 18:33 ` Peter Jones
2009-07-08 18:40 ` Christoph Hellwig
2009-07-08 18:47 ` Peter Jones
2009-07-15 20:33 ` Chandra Seetharaman
2009-07-16 1:16 ` James Bottomley
2009-07-17 1:01 ` Chandra Seetharaman
2009-07-17 4:19 ` James Bottomley
2009-07-17 14:14 ` Peter Jones
2009-07-17 16:45 ` James Bottomley
2009-07-17 17:13 ` Peter Jones
2009-06-19 19:37 ` Chandra Seetharaman
2009-07-06 22:30 ` Chandra Seetharaman
-- strict thread matches above, loose matches on Subject: below --
2009-03-18 1:36 Chandra Seetharaman
2009-03-18 1:36 ` [PATCH 3/3] scsi_dh: Workaround a race condition in module insertion 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=20090427180627.22758.59210.sendpatchset@chandra-ubuntu \
--to=sekharan@us.ibm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=hare@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=pjones@redhat.com \
/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