From: Chandra Seetharaman <sekharan@us.ibm.com>
To: "Moger, Babu" <Babu.Moger@lsi.com>
Cc: device-mapper development <dm-devel@redhat.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: RE: [dm-devel] failover does not work with rdac device handler
Date: Thu, 23 Oct 2008 10:15:04 -0700 [thread overview]
Message-ID: <1224782104.14830.870.camel@chandra-ubuntu> (raw)
In-Reply-To: <E463DF2B2E584B4A82673F53D62C2EF45BCE45E0@cosmail01.lsi.com>
Hi Babu,
There is an another issue w.r.t non-listed devices (like you tested).
The issue is that when the device disappears and reappear, the dh_state
file is not created for them. I wanted to send the patch for that also
together with this one. That is the reason for delay.
chandra
On Thu, 2008-10-23 at 08:12 -0600, Moger, Babu wrote:
> Hello Chandra,
> I have not seen this patch being submitted to mainstream kernel. When are you planning to submit this patch? Should I open a bugzilla for tracking purposes?
>
> Thanks
> Babu Moger
> -----Original Message-----
> From: Chandra Seetharaman [mailto:sekharan@us.ibm.com]
> Sent: Tuesday, October 07, 2008 2:19 PM
> To: Moger, Babu
> Cc: device-mapper development; linux-scsi@vger.kernel.org
> Subject: RE: [dm-devel] failover does not work with rdac device handler
>
>
> Sorry, I sent an imcomplete patch. Here is the correct one.
>
> BTW, The panic you saw is caused by the line (one of the lines you
> added):
>
> dev = container_of(&scsi_dh_data, struct scsi_device, scsi_dh_data);
>
> in scsi_dh_release(). We cannot use pointer in a structure to get the
> parent structure.
>
> chandra
>
> Keep a reference count of attaches, so that same number of detaches are allowed.
> -----------
>
> Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
> ---
> Index: linux-2.6.27-rc8-git5/drivers/scsi/device_handler/scsi_dh.c
> ===================================================================
> --- linux-2.6.27-rc8-git5.orig/drivers/scsi/device_handler/scsi_dh.c
> +++ linux-2.6.27-rc8-git5/drivers/scsi/device_handler/scsi_dh.c
> @@ -153,12 +153,28 @@ static int scsi_dh_handler_attach(struct
> if (sdev->scsi_dh_data) {
> if (sdev->scsi_dh_data->scsi_dh != scsi_dh)
> err = -EBUSY;
> - } else if (scsi_dh->attach)
> + else
> + kref_get(&sdev->scsi_dh_data->kref);
> + } else if (scsi_dh->attach) {
> err = scsi_dh->attach(sdev);
> + if (!err) {
> + kref_init(&sdev->scsi_dh_data->kref);
> + sdev->scsi_dh_data->sdev = sdev;
> + }
> + }
>
> return err;
> }
>
> +static void scsi_dh_release(struct kref *kref)
> +{
> + struct scsi_dh_data *scsi_dh_data;
> + scsi_dh_data = container_of(kref, struct scsi_dh_data, kref);
> +
> + if (scsi_dh_data->scsi_dh && scsi_dh_data->scsi_dh->detach)
> + scsi_dh_data->scsi_dh->detach(scsi_dh_data->sdev);
> +}
> +
> /*
> * scsi_dh_handler_detach - Detach a device handler from a device
> * @sdev - SCSI device the device handler should be detached from
> @@ -176,11 +192,7 @@ static void scsi_dh_handler_detach(struc
> if (scsi_dh && scsi_dh != sdev->scsi_dh_data->scsi_dh)
> return;
>
> - if (!scsi_dh)
> - scsi_dh = sdev->scsi_dh_data->scsi_dh;
> -
> - if (scsi_dh && scsi_dh->detach)
> - scsi_dh->detach(sdev);
> + kref_put(&sdev->scsi_dh_data->kref, scsi_dh_release);
> }
>
> /*
> Index: linux-2.6.27-rc8-git5/include/scsi/scsi_device.h
> ===================================================================
> --- linux-2.6.27-rc8-git5.orig/include/scsi/scsi_device.h
> +++ linux-2.6.27-rc8-git5/include/scsi/scsi_device.h
> @@ -6,6 +6,7 @@
> #include <linux/spinlock.h>
> #include <linux/workqueue.h>
> #include <linux/blkdev.h>
> +#include <linux/kref.h>
> #include <scsi/scsi.h>
> #include <asm/atomic.h>
>
> @@ -191,6 +192,8 @@ struct scsi_device_handler {
>
> struct scsi_dh_data {
> struct scsi_device_handler *scsi_dh;
> + struct kref kref;
> + struct scsi_device *sdev; /* back reference */
> char buf[0];
> };
>
>
>
next prev parent reply other threads:[~2008-10-23 17:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 17:01 Patch: add Dell product information into rdac device handler Yanqing_Liu
2008-09-30 17:57 ` Chandra Seetharaman
2008-10-01 14:12 ` [dm-devel] " James Bottomley
2008-10-01 21:47 ` failover does not work with " Moger, Babu
2008-10-04 0:12 ` Moger, Babu
2008-10-04 0:50 ` [dm-devel] " Chandra Seetharaman
2008-10-04 3:35 ` Moger, Babu
2008-10-06 19:26 ` Moger, Babu
2008-10-06 19:53 ` [dm-devel] " Chandra Seetharaman
2008-10-06 19:59 ` Moger, Babu
2008-10-06 22:26 ` Moger, Babu
2008-10-07 2:04 ` [dm-devel] " Chandra Seetharaman
2008-10-07 18:34 ` Moger, Babu
2008-10-07 19:19 ` [dm-devel] " Chandra Seetharaman
2008-10-07 20:26 ` Moger, Babu
2008-10-23 14:12 ` [dm-devel] " Moger, Babu
2008-10-23 17:15 ` Chandra Seetharaman [this message]
2008-10-23 17:31 ` Moger, Babu
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=1224782104.14830.870.camel@chandra-ubuntu \
--to=sekharan@us.ibm.com \
--cc=Babu.Moger@lsi.com \
--cc=dm-devel@redhat.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