* Patch: add Dell product information into rdac device handler
@ 2008-09-30 17:01 Yanqing_Liu
2008-09-30 17:57 ` Chandra Seetharaman
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Yanqing_Liu @ 2008-09-30 17:01 UTC (permalink / raw)
To: dm-devel, linux-scsi; +Cc: Charles_Rose, mchristi, Shyam_Iyer
[-- Attachment #1.1: Type: text/plain, Size: 515 bytes --]
Hi all,
This patch is to add Dell Powervault storage arrays into device list for
rdac device handler.
--- linux-2.6.27-rc7/drivers/scsi/device_handler/scsi_dh_rdac.c.orig
2008-09-29 02:31:26.000000000 -0400
+++ linux-2.6.27-rc7/drivers/scsi/device_handler/scsi_dh_rdac.c
2008-09-30 02:06:26.000000000 -0400
@@ -590,6 +590,8 @@
{"STK", "OPENstorage D280"},
{"SUN", "CSM200_R"},
{"SUN", "LCSM100_F"},
+ {"DELL", "MD3000"},
+ {"DELL", "MD3000i"},
{NULL, NULL},
};
Thanks,
Yanqing
[-- Attachment #1.2: Type: text/html, Size: 1923 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: Patch: add Dell product information into rdac device handler 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 2 siblings, 0 replies; 18+ messages in thread From: Chandra Seetharaman @ 2008-09-30 17:57 UTC (permalink / raw) To: Yanqing_Liu; +Cc: dm-devel, linux-scsi, mchristi, Shyam_Iyer, Charles_Rose Acked-by: Chandra Seetharaman <sekharan@us.ibm.com> On Tue, 2008-09-30 at 12:01 -0500, Yanqing_Liu@Dell.com wrote: > Hi all, > > This patch is to add Dell Powervault storage arrays into device list > for rdac device handler. > > > --- linux-2.6.27-rc7/drivers/scsi/device_handler/scsi_dh_rdac.c.orig > 2008-09-29 02:31:26.000000000 -0400 > +++ linux-2.6.27-rc7/drivers/scsi/device_handler/scsi_dh_rdac.c > 2008-09-30 02:06:26.000000000 -0400 > @@ -590,6 +590,8 @@ > {"STK", "OPENstorage D280"}, > {"SUN", "CSM200_R"}, > {"SUN", "LCSM100_F"}, > + {"DELL", "MD3000"}, > + {"DELL", "MD3000i"}, > {NULL, NULL}, > }; > > > Thanks, > Yanqing > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dm-devel] Patch: add Dell product information into rdac device handler 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 ` James Bottomley 2008-10-01 21:47 ` failover does not work with " Moger, Babu 2 siblings, 0 replies; 18+ messages in thread From: James Bottomley @ 2008-10-01 14:12 UTC (permalink / raw) To: device-mapper development; +Cc: linux-scsi, Charles_Rose, mchristi, Shyam_Iyer On Tue, 2008-09-30 at 12:01 -0500, Yanqing_Liu@Dell.com wrote: > This patch is to add Dell Powervault storage arrays into device list > for rdac device handler. Could you resend this patch with your signoff and as text/plain, not with mixed html (this is the reason it hasn't appeared on linux-scsi; vger disposes of all html email). The guide Documentation/SubmittingPatches covers all of this. Thanks, James ^ permalink raw reply [flat|nested] 18+ messages in thread
* failover does not work with rdac device handler 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 ` Moger, Babu 2008-10-04 0:12 ` Moger, Babu 2 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-01 21:47 UTC (permalink / raw) To: device-mapper development, linux-scsi@vger.kernel.org Hi All, I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. But I found that for some reason failover/failback is not working. I am seeing following these messages. "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." I can see that scsi_dh_rdac driver is already loaded. I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). My question - is it required to add all the supported vendor and model names in rdac_dev_list? Appreciate your responses. Thanks Babu Moger ^ permalink raw reply [flat|nested] 18+ messages in thread
* failover does not work with rdac device handler 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 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-04 0:12 UTC (permalink / raw) To: device-mapper development, linux-scsi@vger.kernel.org Hi, I have quick question. I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). Discovery seems fine. But, failover is not working. I am seeing the following error. "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." Is it required to add vendor id and model id anywhere else to support this device? Thanks Babu Moger -----Original Message----- From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu Sent: Wednesday, October 01, 2008 4:48 PM To: device-mapper development; linux-scsi@vger.kernel.org Subject: [dm-devel] failover does not work with rdac device handler Hi All, I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. But I found that for some reason failover/failback is not working. I am seeing following these messages. "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." I can see that scsi_dh_rdac driver is already loaded. I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). My question - is it required to add all the supported vendor and model names in rdac_dev_list? Appreciate your responses. Thanks Babu Moger -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dm-devel] failover does not work with rdac device handler 2008-10-04 0:12 ` Moger, Babu @ 2008-10-04 0:50 ` Chandra Seetharaman 2008-10-04 3:35 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Chandra Seetharaman @ 2008-10-04 0:50 UTC (permalink / raw) To: Moger, Babu; +Cc: device-mapper development, linux-scsi@vger.kernel.org It is supposed to work. I will look into it and respond. Can you try one thing for all your devices, do echo rdac > /sys/block/sd?/dh_state (first you can read the files and see if they all show rdac or not) and then do your fail over. Let me know what happens. chandra On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > Hi, > > I have quick question. > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > Is it required to add vendor id and model id anywhere else to support this device? > > Thanks > Babu Moger > > > -----Original Message----- > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > Sent: Wednesday, October 01, 2008 4:48 PM > To: device-mapper development; linux-scsi@vger.kernel.org > Subject: [dm-devel] failover does not work with rdac device handler > > Hi All, > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > I can see that scsi_dh_rdac driver is already loaded. > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > Appreciate your responses. > > Thanks > Babu Moger > > > > > > > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 2008-10-04 0:50 ` [dm-devel] " Chandra Seetharaman @ 2008-10-04 3:35 ` Moger, Babu 2008-10-06 19:26 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-04 3:35 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org Thanks Chandra for the response.. That is the good news. So, we do not have to change the kernel code everytime we want to support the new product. I will do the steps you mentioned first thing on Monday and reply your back. Thanks Babu Moger ________________________________________ From: Chandra Seetharaman [sekharan@us.ibm.com] Sent: Friday, October 03, 2008 7:50 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 It is supposed to work. I will look into it and respond. Can you try one thing for all your devices, do echo rdac > /sys/block/sd?/dh_state (first you can read the files and see if they all show rdac or not) and then do your fail over. Let me know what happens. chandra On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > Hi, > > I have quick question. > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > Is it required to add vendor id and model id anywhere else to support this device? > > Thanks > Babu Moger > > > -----Original Message----- > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > Sent: Wednesday, October 01, 2008 4:48 PM > To: device-mapper development; linux-scsi@vger.kernel.org > Subject: [dm-devel] failover does not work with rdac device handler > > Hi All, > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > I can see that scsi_dh_rdac driver is already loaded. > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > Appreciate your responses. > > Thanks > Babu Moger > > > > > > > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 2008-10-04 3:35 ` Moger, Babu @ 2008-10-06 19:26 ` Moger, Babu 2008-10-06 19:53 ` [dm-devel] " Chandra Seetharaman 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-06 19:26 UTC (permalink / raw) To: Moger, Babu, sekharan@us.ibm.com Cc: device-mapper development, linux-scsi@vger.kernel.org Hi Chandra, All the dh_state values show "rdac". I have cut pasted the output below. I am seeing the following error messages when I tried to failover. Oct 6 13:50:01 localhost multipathd: 8:96: reinstated Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded. Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Failing path 8:96. Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Could not failover device. Error 15. Oct 6 13:50:01 localhost multipathd: 8:96: mark as failed Output of # multipath -ll mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] \_ round-robin 0 [prio=6][active] \_ 3:0:0:2 sdf 8:80 [active][ready] \_ 3:0:2:2 sdl 8:176 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 3:0:1:2 sdi 8:128 [active][ghost] \_ 3:0:3:2 sdo 8:224 [active][ghost] dh_state values. #cat /sys/block/sdf/device/dh_state rdac #cat /sys/block/sdl/device/dh_state rdac #cat /sys/block/sdi/device/dh_state rdac # cat /sys/block/sdo/device/dh_state rdac Please let me know what you think. Note (Kernel version 2.6.27-rc7 and multipath-tools v0.4.8) Thanks Babu Moger -----Original Message----- From: Moger, Babu Sent: Friday, October 03, 2008 10:35 PM To: sekharan@us.ibm.com Cc: device-mapper development; linux-scsi@vger.kernel.org Subject: RE: [dm-devel] failover does not work with rdac device handler Thanks Chandra for the response.. That is the good news. So, we do not have to change the kernel code everytime we want to support the new product. I will do the steps you mentioned first thing on Monday and reply your back. Thanks Babu Moger ________________________________________ From: Chandra Seetharaman [sekharan@us.ibm.com] Sent: Friday, October 03, 2008 7:50 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 It is supposed to work. I will look into it and respond. Can you try one thing for all your devices, do echo rdac > /sys/block/sd?/dh_state (first you can read the files and see if they all show rdac or not) and then do your fail over. Let me know what happens. chandra On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > Hi, > > I have quick question. > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > Is it required to add vendor id and model id anywhere else to support this device? > > Thanks > Babu Moger > > > -----Original Message----- > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > Sent: Wednesday, October 01, 2008 4:48 PM > To: device-mapper development; linux-scsi@vger.kernel.org > Subject: [dm-devel] failover does not work with rdac device handler > > Hi All, > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > I can see that scsi_dh_rdac driver is already loaded. > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > Appreciate your responses. > > Thanks > Babu Moger > > > > > > > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-06 19:26 ` Moger, Babu @ 2008-10-06 19:53 ` Chandra Seetharaman 2008-10-06 19:59 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Chandra Seetharaman @ 2008-10-06 19:53 UTC (permalink / raw) To: Moger, Babu; +Cc: device-mapper development, linux-scsi@vger.kernel.org Is this the only rdac device that is present ? Can you also get me the o/p of "lsmod | grep scsi_dh_rdac" (just wanted to make sure if each (SCSI) device has a module. On Mon, 2008-10-06 at 13:26 -0600, Moger, Babu wrote: > Hi Chandra, > > All the dh_state values show "rdac". I have cut pasted the output below. > > I am seeing the following error messages when I tried to failover. > > Oct 6 13:50:01 localhost multipathd: 8:96: reinstated > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Failing path 8:96. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Could not failover device. Error 15. > Oct 6 13:50:01 localhost multipathd: 8:96: mark as failed > > > Output of # multipath -ll > > mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 > [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] > \_ round-robin 0 [prio=6][active] > \_ 3:0:0:2 sdf 8:80 [active][ready] > \_ 3:0:2:2 sdl 8:176 [active][ready] > \_ round-robin 0 [prio=0][enabled] > \_ 3:0:1:2 sdi 8:128 [active][ghost] > \_ 3:0:3:2 sdo 8:224 [active][ghost] > > > dh_state values. > > #cat /sys/block/sdf/device/dh_state > rdac > > #cat /sys/block/sdl/device/dh_state > rdac > > #cat /sys/block/sdi/device/dh_state > rdac > > # cat /sys/block/sdo/device/dh_state > rdac > > Please let me know what you think. > Note (Kernel version 2.6.27-rc7 and multipath-tools v0.4.8) > > Thanks > Babu Moger > > -----Original Message----- > From: Moger, Babu > Sent: Friday, October 03, 2008 10:35 PM > To: sekharan@us.ibm.com > Cc: device-mapper development; linux-scsi@vger.kernel.org > Subject: RE: [dm-devel] failover does not work with rdac device handler > > Thanks Chandra for the response.. > > That is the good news. So, we do not have to change the kernel code everytime we want to support the new product. > > I will do the steps you mentioned first thing on Monday and reply your back. > > Thanks > Babu Moger > > ________________________________________ > From: Chandra Seetharaman [sekharan@us.ibm.com] > Sent: Friday, October 03, 2008 7:50 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 > > It is supposed to work. I will look into it and respond. > > Can you try one thing > > for all your devices, do > echo rdac > /sys/block/sd?/dh_state > > (first you can read the files and see if they all show rdac or not) > > and then do your fail over. Let me know what happens. > > chandra > On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > > Hi, > > > > I have quick question. > > > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > Is it required to add vendor id and model id anywhere else to support this device? > > > > Thanks > > Babu Moger > > > > > > -----Original Message----- > > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > > Sent: Wednesday, October 01, 2008 4:48 PM > > To: device-mapper development; linux-scsi@vger.kernel.org > > Subject: [dm-devel] failover does not work with rdac device handler > > > > Hi All, > > > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > I can see that scsi_dh_rdac driver is already loaded. > > > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > > > Appreciate your responses. > > > > Thanks > > Babu Moger > > > > > > > > > > > > > > > > -- > > dm-devel mailing list > > dm-devel@redhat.com > > https://www.redhat.com/mailman/listinfo/dm-devel > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 2008-10-06 19:53 ` [dm-devel] " Chandra Seetharaman @ 2008-10-06 19:59 ` Moger, Babu 2008-10-06 22:26 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-06 19:59 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org I have configured two Luns. # lsmod | grep scsi_dh_rdac scsi_dh_rdac 39044 8 scsi_dh 40068 2 scsi_dh_rdac,dm_multipath scsi_mod 188920 9 scsi_dh_rdac,scsi_dh,sg,lpfc,qla2xxx,scsi_transport_fc,libata,megaraid_sas,sd_mod Here is the complete output. # multipath -ll mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] \_ round-robin 0 [prio=6][active] \_ 3:0:0:2 sdf 8:80 [active][ready] \_ 3:0:2:2 sdl 8:176 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 3:0:1:2 sdi 8:128 [active][ghost] \_ 3:0:3:2 sdo 8:224 [active][ghost] mpath3 (3600a0b80000f519c00007e034714d159) dm-3 LSI,INF-01-00 [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] \_ round-robin 0 [prio=6][active] \_ 3:0:1:3 sdj 8:144 [active][ready] \_ 3:0:3:3 sdp 8:240 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 3:0:0:3 sdg 8:96 [active][ghost] \_ 3:0:2:3 sdm 8:192 [active][ghost] Thanks Babu Moger -----Original Message----- From: Chandra Seetharaman [mailto:sekharan@us.ibm.com] Sent: Monday, October 06, 2008 2:54 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 Is this the only rdac device that is present ? Can you also get me the o/p of "lsmod | grep scsi_dh_rdac" (just wanted to make sure if each (SCSI) device has a module. On Mon, 2008-10-06 at 13:26 -0600, Moger, Babu wrote: > Hi Chandra, > > All the dh_state values show "rdac". I have cut pasted the output below. > > I am seeing the following error messages when I tried to failover. > > Oct 6 13:50:01 localhost multipathd: 8:96: reinstated > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Failing path 8:96. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Could not failover device. Error 15. > Oct 6 13:50:01 localhost multipathd: 8:96: mark as failed > > > Output of # multipath -ll > > mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 > [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] > \_ round-robin 0 [prio=6][active] > \_ 3:0:0:2 sdf 8:80 [active][ready] > \_ 3:0:2:2 sdl 8:176 [active][ready] > \_ round-robin 0 [prio=0][enabled] > \_ 3:0:1:2 sdi 8:128 [active][ghost] > \_ 3:0:3:2 sdo 8:224 [active][ghost] > > > dh_state values. > > #cat /sys/block/sdf/device/dh_state > rdac > > #cat /sys/block/sdl/device/dh_state > rdac > > #cat /sys/block/sdi/device/dh_state > rdac > > # cat /sys/block/sdo/device/dh_state > rdac > > Please let me know what you think. > Note (Kernel version 2.6.27-rc7 and multipath-tools v0.4.8) > > Thanks > Babu Moger > > -----Original Message----- > From: Moger, Babu > Sent: Friday, October 03, 2008 10:35 PM > To: sekharan@us.ibm.com > Cc: device-mapper development; linux-scsi@vger.kernel.org > Subject: RE: [dm-devel] failover does not work with rdac device handler > > Thanks Chandra for the response.. > > That is the good news. So, we do not have to change the kernel code everytime we want to support the new product. > > I will do the steps you mentioned first thing on Monday and reply your back. > > Thanks > Babu Moger > > ________________________________________ > From: Chandra Seetharaman [sekharan@us.ibm.com] > Sent: Friday, October 03, 2008 7:50 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 > > It is supposed to work. I will look into it and respond. > > Can you try one thing > > for all your devices, do > echo rdac > /sys/block/sd?/dh_state > > (first you can read the files and see if they all show rdac or not) > > and then do your fail over. Let me know what happens. > > chandra > On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > > Hi, > > > > I have quick question. > > > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > Is it required to add vendor id and model id anywhere else to support this device? > > > > Thanks > > Babu Moger > > > > > > -----Original Message----- > > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > > Sent: Wednesday, October 01, 2008 4:48 PM > > To: device-mapper development; linux-scsi@vger.kernel.org > > Subject: [dm-devel] failover does not work with rdac device handler > > > > Hi All, > > > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > I can see that scsi_dh_rdac driver is already loaded. > > > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > > > Appreciate your responses. > > > > Thanks > > Babu Moger > > > > > > > > > > > > > > > > -- > > dm-devel mailing list > > dm-devel@redhat.com > > https://www.redhat.com/mailman/listinfo/dm-devel > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 2008-10-06 19:59 ` Moger, Babu @ 2008-10-06 22:26 ` Moger, Babu 2008-10-07 2:04 ` [dm-devel] " Chandra Seetharaman 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-06 22:26 UTC (permalink / raw) To: device-mapper development, sekharan@us.ibm.com; +Cc: linux-scsi@vger.kernel.org Hi Chandra, Please note that failover works fine if I add vendor and model ids("LSI", "INF-01-00")in rdac_dev_list(in the file scsi_dh_rdac.c). Thanks Babu Moger -----Original Message----- From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu Sent: Monday, October 06, 2008 3:00 PM To: sekharan@us.ibm.com Cc: device-mapper development; linux-scsi@vger.kernel.org Subject: RE: [dm-devel] failover does not work with rdac device handler I have configured two Luns. # lsmod | grep scsi_dh_rdac scsi_dh_rdac 39044 8 scsi_dh 40068 2 scsi_dh_rdac,dm_multipath scsi_mod 188920 9 scsi_dh_rdac,scsi_dh,sg,lpfc,qla2xxx,scsi_transport_fc,libata,megaraid_sas,sd_mod Here is the complete output. # multipath -ll mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] \_ round-robin 0 [prio=6][active] \_ 3:0:0:2 sdf 8:80 [active][ready] \_ 3:0:2:2 sdl 8:176 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 3:0:1:2 sdi 8:128 [active][ghost] \_ 3:0:3:2 sdo 8:224 [active][ghost] mpath3 (3600a0b80000f519c00007e034714d159) dm-3 LSI,INF-01-00 [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] \_ round-robin 0 [prio=6][active] \_ 3:0:1:3 sdj 8:144 [active][ready] \_ 3:0:3:3 sdp 8:240 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 3:0:0:3 sdg 8:96 [active][ghost] \_ 3:0:2:3 sdm 8:192 [active][ghost] Thanks Babu Moger -----Original Message----- From: Chandra Seetharaman [mailto:sekharan@us.ibm.com] Sent: Monday, October 06, 2008 2:54 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 Is this the only rdac device that is present ? Can you also get me the o/p of "lsmod | grep scsi_dh_rdac" (just wanted to make sure if each (SCSI) device has a module. On Mon, 2008-10-06 at 13:26 -0600, Moger, Babu wrote: > Hi Chandra, > > All the dh_state values show "rdac". I have cut pasted the output below. > > I am seeing the following error messages when I tried to failover. > > Oct 6 13:50:01 localhost multipathd: 8:96: reinstated > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Failing path 8:96. > Oct 6 13:50:01 localhost kernel: device-mapper: multipath: Could not failover device. Error 15. > Oct 6 13:50:01 localhost multipathd: 8:96: mark as failed > > > Output of # multipath -ll > > mpath2 (3600a0b80000f6a7d000080454714d058) dm-2 LSI,INF-01-00 > [size=10G][features=1 queue_if_no_path][hwhandler=1 rdac][rw] > \_ round-robin 0 [prio=6][active] > \_ 3:0:0:2 sdf 8:80 [active][ready] > \_ 3:0:2:2 sdl 8:176 [active][ready] > \_ round-robin 0 [prio=0][enabled] > \_ 3:0:1:2 sdi 8:128 [active][ghost] > \_ 3:0:3:2 sdo 8:224 [active][ghost] > > > dh_state values. > > #cat /sys/block/sdf/device/dh_state > rdac > > #cat /sys/block/sdl/device/dh_state > rdac > > #cat /sys/block/sdi/device/dh_state > rdac > > # cat /sys/block/sdo/device/dh_state > rdac > > Please let me know what you think. > Note (Kernel version 2.6.27-rc7 and multipath-tools v0.4.8) > > Thanks > Babu Moger > > -----Original Message----- > From: Moger, Babu > Sent: Friday, October 03, 2008 10:35 PM > To: sekharan@us.ibm.com > Cc: device-mapper development; linux-scsi@vger.kernel.org > Subject: RE: [dm-devel] failover does not work with rdac device handler > > Thanks Chandra for the response.. > > That is the good news. So, we do not have to change the kernel code everytime we want to support the new product. > > I will do the steps you mentioned first thing on Monday and reply your back. > > Thanks > Babu Moger > > ________________________________________ > From: Chandra Seetharaman [sekharan@us.ibm.com] > Sent: Friday, October 03, 2008 7:50 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 > > It is supposed to work. I will look into it and respond. > > Can you try one thing > > for all your devices, do > echo rdac > /sys/block/sd?/dh_state > > (first you can read the files and see if they all show rdac or not) > > and then do your fail over. Let me know what happens. > > chandra > On Fri, 2008-10-03 at 18:12 -0600, Moger, Babu wrote: > > Hi, > > > > I have quick question. > > > > I am trying to configure device mapper for my FC array (on my Linux box). I have passed all the arguments from /etc/multipath.conf(like vendor, model etc ..). > > > > Discovery seems fine. But, failover is not working. I am seeing the following error. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > Is it required to add vendor id and model id anywhere else to support this device? > > > > Thanks > > Babu Moger > > > > > > -----Original Message----- > > From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com] On Behalf Of Moger, Babu > > Sent: Wednesday, October 01, 2008 4:48 PM > > To: device-mapper development; linux-scsi@vger.kernel.org > > Subject: [dm-devel] failover does not work with rdac device handler > > > > Hi All, > > > > I am new to the device mapper and just thought I will set-up device mapper on our arrays. I am using the latest kernel 2.6.27.rc6 and got the latest multipath-tools from upstream. > > > > I updated /etc/multipath.conf with all the information (vendor, product, hardware_handler, prio etc ...). Note that my device is not part of rdac_dev_list. > > > > Discovery worked fine. "multipath -ll" displays all the information. I can see that it is picking up rdac device handler. > > > > But I found that for some reason failover/failback is not working. I am seeing following these messages. > > > > "device-mapper: multipath: Cannot failover device because scsi_dh_rdac was not loaded." > > > > I can see that scsi_dh_rdac driver is already loaded. > > > > I did some more investigation. Found that failover works fine if I add vendor, model in rdac_dev_list (in file scsi_dh_rdac.c). > > > > My question - is it required to add all the supported vendor and model names in rdac_dev_list? > > > > Appreciate your responses. > > > > Thanks > > Babu Moger > > > > > > > > > > > > > > > > -- > > dm-devel mailing list > > dm-devel@redhat.com > > https://www.redhat.com/mailman/listinfo/dm-devel > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-06 22:26 ` Moger, Babu @ 2008-10-07 2:04 ` Chandra Seetharaman 2008-10-07 18:34 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Chandra Seetharaman @ 2008-10-07 2:04 UTC (permalink / raw) To: Moger, Babu; +Cc: device-mapper development, linux-scsi@vger.kernel.org Hi, Can you try the attached patch. chandra PS: I see a problem (not related to this patch) that the dh_state file is not getting recreated, still working on it. ------------- 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,26 @@ 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); + } 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(sdev); +} + /* * scsi_dh_handler_detach - Detach a device handler from a device * @sdev - SCSI device the device handler should be detached from @@ -176,11 +190,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 @@ -191,6 +191,7 @@ struct scsi_device_handler { struct scsi_dh_data { struct scsi_device_handler *scsi_dh; + struct kref kref; char buf[0]; }; ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 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 0 siblings, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-07 18:34 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org Hi Chandra, I have both good news and bad news with this patch. Good news is failover is happening (I am not seeing the earlier message "Cannot failover device because scsi_dh_rdac was not loaded"). Bad news is, I am seeing the below soft-panic. Oct 7 12:50:15 localhost kernel: BUG: unable to handle kernel NULL pointer dereference at 0000000000000238 Oct 7 12:50:15 localhost kernel: IP: [<ffffffffa038e283>] rdac_bus_detach+0xd/0x9a [scsi_dh_rdac] Oct 7 12:50:15 localhost kernel: PGD 0 Oct 7 12:50:15 localhost kernel: Oops: 0000 [1] SMP Oct 7 12:50:15 localhost kernel: CPU 3 Oct 7 12:50:15 localhost kernel: Modules linked in: ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp autofs4 i2c_dev i2c_core hidp rfcomm l2cap bluetooth sunrpc dm_round_robin scsi_dh_rdac dm_multipath scsi_dh sbs sbshc battery acpi_memhotplug ac ipv6 parport_pc lp parport joydev sg bnx2 ide_cd_mod cdrom button rtc_cmos dcdbas serio_raw rtc_core i5000_edac shpchp edac_core rtc_lib pcspkr dm_snapshot dm_zero dm_mirror dm_log dm_mod lpfc qla2xxx scsi_transport_fc ata_piix libata megaraid_sas sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd [last unloaded: microcode] Oct 7 12:50:15 localhost kernel: Pid: 683, comm: fc_wq_3 Not tainted 2.6.27-rc7-babu #2 Oct 7 12:50:15 localhost kernel: RIP: 0010:[<ffffffffa038e283>] [<ffffffffa038e283>] rdac_bus_detach+0xd/0x9a [scsi_dh_rdac] Oct 7 12:50:15 localhost kernel: RSP: 0018:ffff88007d4b3cd0 EFLAGS: 00010282 Oct 7 12:50:15 localhost kernel: RAX: 0000000000000000 RBX: ffff88007d4b3730 RCX: ffffffff00007530 Oct 7 12:50:15 localhost kernel: RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff88007d4b3730 Oct 7 12:50:15 localhost kernel: RBP: ffffffffa0376000 R08: ffff88007d54ef50 R09: ffff88007fb79090 Oct 7 12:50:15 localhost kernel: R10: 0000000000000000 R11: ffffffff802fa1f5 R12: 0000000000000002 Oct 7 12:50:15 localhost kernel: R13: ffff88007db97920 R14: 0000000000000002 R15: ffff88007db97920 Oct 7 12:50:15 localhost kernel: FS: 0000000000000000(0000) GS:ffff88007f005640(0000) knlGS:0000000000000000 Oct 7 12:50:15 localhost kernel: CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b Oct 7 12:50:15 localhost kernel: CR2: 0000000000000238 CR3: 0000000000201000 CR4: 00000000000006e0 Oct 7 12:50:15 localhost kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Oct 7 12:50:15 localhost kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Oct 7 12:50:15 localhost kernel: Process fc_wq_3 (pid: 683, threadinfo ffff88007d4b2000, task ffff88007f1f88d0) Oct 7 12:50:15 localhost kernel: Stack: ffff88007db97920 ffff88007b0e1c08 ffffffffa0376000 ffffffffa0376029 Oct 7 12:50:15 localhost kernel: ffff88007d54ef50 ffff88007c45f4b0 ffff88007b0e1c00 ffffffff8031e383 Oct 7 12:50:15 localhost kernel: ffff88007db97800 ffff88007db97800 ffff88007db97920 ffffffffa0376443 Oct 7 12:50:15 localhost kernel: Call Trace: Oct 7 12:50:15 localhost kernel: [<ffffffffa0376000>] ? scsi_dh_release+0x0/0x2e [scsi_dh] Oct 7 12:50:15 localhost kernel: [<ffffffffa0376029>] ? scsi_dh_release+0x29/0x2e [scsi_dh] Oct 7 12:50:15 localhost kernel: [<ffffffff8031e383>] ? kref_put+0x41/0x4c Oct 7 12:50:15 localhost kernel: [<ffffffffa0376443>] ? scsi_dh_notifier+0x73/0x7a [scsi_dh] Oct 7 12:50:15 localhost kernel: [<ffffffff80483885>] ? notifier_call_chain+0x29/0x4c Oct 7 12:50:15 localhost kernel: [<ffffffff80249a4c>] ? __blocking_notifier_call_chain+0x48/0x62 Oct 7 12:50:15 localhost kernel: [<ffffffff80396099>] ? device_del+0x150/0x178 Oct 7 12:50:15 localhost kernel: [<ffffffffa0074f2e>] ? __scsi_remove_device+0x3a/0x7a [scsi_mod] Oct 7 12:50:15 localhost kernel: [<ffffffffa0074f8f>] ? scsi_remove_device+0x21/0x2e [scsi_mod] Oct 7 12:50:15 localhost kernel: [<ffffffffa0075021>] ? __scsi_remove_target+0x85/0xc3 [scsi_mod] Oct 7 12:50:15 localhost kernel: [<ffffffffa00750a4>] ? __remove_child+0x0/0x1a [scsi_mod] Oct 7 12:50:16 localhost kernel: [<ffffffffa00750ba>] ? __remove_child+0x16/0x1a [scsi_mod] Oct 7 12:50:16 localhost kernel: [<ffffffff80395955>] ? device_for_each_child+0x22/0x4d Oct 7 12:50:16 localhost kernel: [<ffffffffa0075099>] ? scsi_remove_target+0x3a/0x45 [scsi_mod] Oct 7 12:50:16 localhost kernel: [<ffffffffa00fd7b9>] ? fc_starget_delete+0x0/0x64 [scsi_transport_fc] Oct 7 12:50:16 localhost kernel: [<ffffffff802439e4>] ? run_workqueue+0x7a/0x102 Oct 7 12:50:16 localhost kernel: [<ffffffff802442dc>] ? worker_thread+0xd5/0xe0 Oct 7 12:50:16 localhost kernel: [<ffffffff80246a8e>] ? autoremove_wake_function+0x0/0x2e Oct 7 12:50:16 localhost kernel: [<ffffffff80244207>] ? worker_thread+0x0/0xe0 Oct 7 12:50:16 localhost multipathd: mpath2: load table [0 20971520 multipath 0 1 rdac 2 1 round-robin 0 2 1 8:80 300 8:176 300 round-robin 0 1 1 8:224 100] Oct 7 12:50:16 localhost kernel: [<ffffffff80246960>] ? kthread+0x47/0x73 Oct 7 12:50:16 localhost kernel: [<ffffffff80230fc3>] ? schedule_tail+0x28/0x60 Oct 7 12:50:16 localhost kernel: [<ffffffff8020cd49>] ? child_rip+0xa/0x11 Oct 7 12:50:16 localhost kernel: [<ffffffff80246919>] ? kthread+0x0/0x73 Oct 7 12:50:16 localhost kernel: [<ffffffff8020cd3f>] ? child_rip+0x0/0x11 Oct 7 12:50:16 localhost kernel: Oct 7 12:50:16 localhost kernel: Oct 7 12:50:16 localhost kernel: Code: a0 31 c0 e8 8e 80 ea df c6 43 0d 02 eb 08 a8 01 74 04 c6 43 0d 01 5b 5d 44 89 e0 41 5c c3 55 53 48 89 fb 48 83 ec 08 48 8b 47 08 <48> 8b b8 38 02 00 00 e8 e0 30 0f e0 48 89 c6 48 8b 43 08 48 8b Oct 7 12:50:16 localhost kernel: RIP [<ffffffffa038e283>] rdac_bus_detach+0xd/0x9a [scsi_dh_rdac] Oct 7 12:50:16 localhost kernel: RSP <ffff88007d4b3cd0> Oct 7 12:50:16 localhost kernel: CR2: 0000000000000238 Oct 7 12:50:16 localhost kernel: ---[ end trace 9be4f9e6c2a759cf ]--- ------------------------------------------------------------------------- Your patch did not compile straight away (on scsi_dh.c). I had to do some changes. I did few changes with the knowledge I had. Correct me if there is anything wrong. Here is the patch. --- scsi_dh.c 2008-10-07 10:25:40.000000000 -0500 +++ linux-2.6.27-rc7-babu/drivers/scsi/device_handler/scsi_dh.c 2008-10-07 12:13:19.000000000 -0500 @@ -148,17 +148,35 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev, struct scsi_device_handler *scsi_dh) { + int err = 0; - if (sdev->scsi_dh_data) { + if (sdev->scsi_dh_data){ if (sdev->scsi_dh_data->scsi_dh != scsi_dh) err = -EBUSY; - } else if (scsi_dh->attach) - err = scsi_dh->attach(sdev); + 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); + } return err; } +static void scsi_dh_release(struct kref *kref) +{ + struct scsi_dh_data *scsi_dh_data; + struct scsi_device *sdev; + scsi_dh_data = container_of(kref, struct scsi_dh_data, kref); + sdev = container_of(&scsi_dh_data, struct scsi_device, scsi_dh_data); + + if (scsi_dh_data->scsi_dh && scsi_dh_data->scsi_dh->detach) + scsi_dh_data->scsi_dh->detach(sdev); +} + + /* * scsi_dh_handler_detach - Detach a device handler from a device * @sdev - SCSI device the device handler should be detached from @@ -175,12 +193,7 @@ 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); } /* PS: Yes. You are right. With linux-2.6.27-rc8 sources, I am not seeing the dh_state in sysfs filesystem. That is the reason I reverted back to linux-2.6.27-rc7. Thanks Babu Moger -----Original Message----- From: Chandra Seetharaman [mailto:sekharan@us.ibm.com] Sent: Monday, October 06, 2008 9:05 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 Hi, Can you try the attached patch. chandra PS: I see a problem (not related to this patch) that the dh_state file is not getting recreated, still working on it. ------------- 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,26 @@ 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); + } 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(sdev); +} + /* * scsi_dh_handler_detach - Detach a device handler from a device * @sdev - SCSI device the device handler should be detached from @@ -176,11 +190,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 @@ -191,6 +191,7 @@ struct scsi_device_handler { struct scsi_dh_data { struct scsi_device_handler *scsi_dh; + struct kref kref; char buf[0]; }; ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-07 18:34 ` Moger, Babu @ 2008-10-07 19:19 ` Chandra Seetharaman 2008-10-07 20:26 ` Moger, Babu 2008-10-23 14:12 ` [dm-devel] " Moger, Babu 0 siblings, 2 replies; 18+ messages in thread From: Chandra Seetharaman @ 2008-10-07 19:19 UTC (permalink / raw) To: Moger, Babu; +Cc: device-mapper development, linux-scsi@vger.kernel.org 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]; }; ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: failover does not work with rdac device handler 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 1 sibling, 0 replies; 18+ messages in thread From: Moger, Babu @ 2008-10-07 20:26 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org Hi Chandra, Yes. It works fine now. I tested failover/failback few times and it works as expected. Thanks you very much for helping me to resolve this problem. Please let us know when this change is available in upstream kernel. 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]; }; ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-07 19:19 ` [dm-devel] " Chandra Seetharaman 2008-10-07 20:26 ` Moger, Babu @ 2008-10-23 14:12 ` Moger, Babu 2008-10-23 17:15 ` Chandra Seetharaman 1 sibling, 1 reply; 18+ messages in thread From: Moger, Babu @ 2008-10-23 14:12 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org 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]; }; ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-23 14:12 ` [dm-devel] " Moger, Babu @ 2008-10-23 17:15 ` Chandra Seetharaman 2008-10-23 17:31 ` Moger, Babu 0 siblings, 1 reply; 18+ messages in thread From: Chandra Seetharaman @ 2008-10-23 17:15 UTC (permalink / raw) To: Moger, Babu; +Cc: device-mapper development, linux-scsi@vger.kernel.org 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]; > }; > > > ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [dm-devel] failover does not work with rdac device handler 2008-10-23 17:15 ` Chandra Seetharaman @ 2008-10-23 17:31 ` Moger, Babu 0 siblings, 0 replies; 18+ messages in thread From: Moger, Babu @ 2008-10-23 17:31 UTC (permalink / raw) To: sekharan@us.ibm.com; +Cc: device-mapper development, linux-scsi@vger.kernel.org Thanks for the updates.. Babu Moger -----Original Message----- From: Chandra Seetharaman [mailto:sekharan@us.ibm.com] Sent: Thursday, October 23, 2008 12:15 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 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]; > }; > > > ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2008-10-23 17:32 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2008-10-23 17:31 ` Moger, Babu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox