* [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac
@ 2007-03-21 19:38 Chandra Seetharaman
2007-03-21 19:38 ` [PATCH 1/3] C4 Inquiry based path checker Chandra Seetharaman
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Chandra Seetharaman @ 2007-03-21 19:38 UTC (permalink / raw)
To: dm-devel; +Cc: andmike, michaelc, christophe.varoqui, agk
Hi All,
While working on lsi-rdac hardware handler, I found that the checkers "tur"
and "readsector0" are not serving the lsi-rdac properly. Also, the storage
device has a active/passive state which need to be handled properly.
So, I wrote a new path checker for lsi-rdac, to use the C4 inquiry page to get
the current owner of the lun and set the state as UP(active) or GHOST(passive).
Changes are in patch 1/3.
After applying the above patch, I realized the priorities are not set properly.
Made some changes to use the GHOST state while setting priorities. Changes are
in patch 2/3.
Debugging the above patches found that the wait time (5 seconds) in multipathd
was not sufficient for the devices to appear in /dev/ It was taking about 20
seconds. Changed the wait time to be 60 seconds. Change in patch 3/3.
Please provide me with your feedback/comment on these changes regarding
correctness, completeness etc.,
Thanks & regards,
chandra
--
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- sekharan@us.ibm.com | .......you may get it.
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/3] C4 Inquiry based path checker 2007-03-21 19:38 [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Chandra Seetharaman @ 2007-03-21 19:38 ` Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 2/3] Fix the priority calculation to use PATH_GHOST state Chandra Seetharaman ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Chandra Seetharaman @ 2007-03-21 19:38 UTC (permalink / raw) To: dm-devel; +Cc: andmike, michaelc, christophe.varoqui, agk Index: multipath-tools-0.4.7/libcheckers/Makefile =================================================================== --- multipath-tools-0.4.7.orig/libcheckers/Makefile 2007-03-02 18:42:00.000000000 -0800 +++ multipath-tools-0.4.7/libcheckers/Makefile 2007-03-02 18:42:19.000000000 -0800 @@ -6,7 +6,7 @@ include ../Makefile.inc -OBJS = checkers.o readsector0.o tur.o directio.o emc_clariion.o hp_sw.o +OBJS = checkers.o readsector0.o tur.o directio.o emc_clariion.o hp_sw.o rdac.o all: $(BUILD) Index: multipath-tools-0.4.7/libcheckers/rdac.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ multipath-tools-0.4.7/libcheckers/rdac.c 2007-03-20 14:43:38.000000000 -0700 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2005 Christophe Varoqui + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <errno.h> + +#include "checkers.h" + +#include "../libmultipath/sg_include.h" + +#define INQUIRY_CMDLEN 6 +#define INQUIRY_CMD 0x12 +#define SENSE_BUFF_LEN 32 +#define DEF_TIMEOUT 60000 +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 +#define RECOVERED_ERROR 0x01 + +#define MSG_RDAC_UP "rdac checker reports path is up" +#define MSG_RDAC_DOWN "rdac checker reports path is down" +#define MSG_RDAC_GHOST "rdac checker reports path is ghost" + +struct rdac_checker_context { + void * dummy; +}; + +int rdac_init (struct checker * c) +{ + return 0; +} + +void rdac_free (struct checker * c) +{ + return; +} + +static int +do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len) +{ + unsigned char inqCmdBlk[INQUIRY_CMDLEN] = { INQUIRY_CMD, 1, 0, 0, 0, 0 }; + unsigned char sense_b[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + + inqCmdBlk[2] = (unsigned char) pg_op; + inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff); + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (inqCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_b); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = mx_resp_len; + io_hdr.dxferp = resp; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_b; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) + return 1; + + /* treat SG_ERR here to get rid of sg_err.[ch] */ + io_hdr.status &= 0x7e; + if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && + (0 == io_hdr.driver_status)) + return 0; + if ((SCSI_CHECK_CONDITION == io_hdr.status) || + (SCSI_COMMAND_TERMINATED == io_hdr.status) || + (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { + if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { + int sense_key; + unsigned char * sense_buffer = io_hdr.sbp; + if (sense_buffer[0] & 0x2) + sense_key = sense_buffer[1] & 0xf; + else + sense_key = sense_buffer[2] & 0xf; + if (RECOVERED_ERROR == sense_key) + return 0; + } + } + return 1; +} + +struct volume_access_inq +{ + char dontcare0[8]; + char avtcvp; + char dontcare1[39]; +}; + +extern int +rdac(struct checker * c) +{ + struct volume_access_inq inq; + + if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq))) { + MSG(c, MSG_RDAC_DOWN); + return PATH_DOWN; + } + + return ((inq.avtcvp & 0x1) ? PATH_UP : PATH_GHOST); +} Index: multipath-tools-0.4.7/libcheckers/checkers.c =================================================================== --- multipath-tools-0.4.7.orig/libcheckers/checkers.c 2006-03-13 03:07:45.000000000 -0800 +++ multipath-tools-0.4.7/libcheckers/checkers.c 2007-03-20 14:44:56.000000000 -0700 @@ -7,6 +7,7 @@ #include "tur.h" #include "hp_sw.h" #include "emc_clariion.h" +#include "rdac.h" #include "readsector0.h" static struct checker checkers[] = { @@ -48,6 +49,15 @@ }, { .fd = 0, + .name = RDAC, + .message = "", + .context = NULL, + .check = rdac, + .init = rdac_init, + .free = rdac_free + }, + { + .fd = 0, .name = READSECTOR0, .message = "", .context = NULL, Index: multipath-tools-0.4.7/libcheckers/rdac.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ multipath-tools-0.4.7/libcheckers/rdac.h 2007-03-20 14:43:58.000000000 -0700 @@ -0,0 +1,8 @@ +#ifndef _RDAC_H +#define _RDAC_H + +int rdac(struct checker *); +int rdac_init(struct checker *); +void rdac_free(struct checker *); + +#endif /* _RDAC_H */ Index: multipath-tools-0.4.7/libcheckers/checkers.h =================================================================== --- multipath-tools-0.4.7.orig/libcheckers/checkers.h 2006-03-13 03:07:45.000000000 -0800 +++ multipath-tools-0.4.7/libcheckers/checkers.h 2007-03-02 18:50:48.000000000 -0800 @@ -14,6 +14,7 @@ #define DIRECTIO "directio" #define TUR "tur" #define HP_SW "hp_sw" +#define RDAC "rdac" #define EMC_CLARIION "emc_clariion" #define READSECTOR0 "readsector0" -- ---------------------------------------------------------------------- Chandra Seetharaman | Be careful what you choose.... - sekharan@us.ibm.com | .......you may get it. ---------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] Fix the priority calculation to use PATH_GHOST state 2007-03-21 19:38 [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 1/3] C4 Inquiry based path checker Chandra Seetharaman @ 2007-03-21 19:38 ` Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 3/3] Increase the wait time for device to appear in /dev Chandra Seetharaman 2007-03-21 23:06 ` [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Christophe Varoqui 3 siblings, 0 replies; 7+ messages in thread From: Chandra Seetharaman @ 2007-03-21 19:38 UTC (permalink / raw) To: dm-devel; +Cc: andmike, michaelc, christophe.varoqui, agk Index: multipath-tools-0.4.7/libmultipath/discovery.c =================================================================== --- multipath-tools-0.4.7.orig/libmultipath/discovery.c 2007-03-20 14:45:21.000000000 -0700 +++ multipath-tools-0.4.7/libmultipath/discovery.c 2007-03-20 14:45:41.000000000 -0700 @@ -699,7 +699,7 @@ if (mask & DI_CHECKER && get_state(pp)) goto blank; - if (mask & DI_PRIO && pp->state != PATH_DOWN) + if (mask & DI_PRIO && pp->state == PATH_UP) get_prio(pp); if (mask & DI_WWID && !strlen(pp->wwid)) Index: multipath-tools-0.4.7/libmultipath/switchgroup.c =================================================================== --- multipath-tools-0.4.7.orig/libmultipath/switchgroup.c 2007-03-20 14:45:21.000000000 -0700 +++ multipath-tools-0.4.7/libmultipath/switchgroup.c 2007-03-20 14:45:41.000000000 -0700 @@ -28,7 +28,7 @@ priority = 0; vector_foreach_slot (pgp->paths, pp, j) { - if (pp->state != PATH_DOWN) + if (pp->state == PATH_UP) priority += pp->priority; } pgp->priority = priority; -- ---------------------------------------------------------------------- Chandra Seetharaman | Be careful what you choose.... - sekharan@us.ibm.com | .......you may get it. ---------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] Increase the wait time for device to appear in /dev 2007-03-21 19:38 [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 1/3] C4 Inquiry based path checker Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 2/3] Fix the priority calculation to use PATH_GHOST state Chandra Seetharaman @ 2007-03-21 19:38 ` Chandra Seetharaman 2007-03-21 23:06 ` [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Christophe Varoqui 3 siblings, 0 replies; 7+ messages in thread From: Chandra Seetharaman @ 2007-03-21 19:38 UTC (permalink / raw) To: dm-devel; +Cc: andmike, michaelc, christophe.varoqui, agk Index: multipath-tools-0.4.7/libmultipath/discovery.c =================================================================== --- multipath-tools-0.4.7.orig/libmultipath/discovery.c 2007-03-20 14:45:41.000000000 -0700 +++ multipath-tools-0.4.7/libmultipath/discovery.c 2007-03-20 14:46:16.000000000 -0700 @@ -112,7 +112,7 @@ * not multipath(8), ran by udev */ #if DAEMON -#define WAIT_MAX_SECONDS 5 +#define WAIT_MAX_SECONDS 60 #define WAIT_LOOP_PER_SECOND 5 static int -- ---------------------------------------------------------------------- Chandra Seetharaman | Be careful what you choose.... - sekharan@us.ibm.com | .......you may get it. ---------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac 2007-03-21 19:38 [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Chandra Seetharaman ` (2 preceding siblings ...) 2007-03-21 19:38 ` [PATCH 3/3] Increase the wait time for device to appear in /dev Chandra Seetharaman @ 2007-03-21 23:06 ` Christophe Varoqui 2007-03-22 22:52 ` Bernd Zeimetz 2007-03-22 23:45 ` Chandra Seetharaman 3 siblings, 2 replies; 7+ messages in thread From: Christophe Varoqui @ 2007-03-21 23:06 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: andmike, dm-devel, michaelc, agk Le mercredi 21 mars 2007 à 11:38 -0800, Chandra Seetharaman a écrit : > Hi All, > > While working on lsi-rdac hardware handler, I found that the checkers "tur" > and "readsector0" are not serving the lsi-rdac properly. Also, the storage > device has a active/passive state which need to be handled properly. > > So, I wrote a new path checker for lsi-rdac, to use the C4 inquiry page to get > the current owner of the lun and set the state as UP(active) or GHOST(passive). > Changes are in patch 1/3. > > After applying the above patch, I realized the priorities are not set properly. > Made some changes to use the GHOST state while setting priorities. Changes are > in patch 2/3. > > Debugging the above patches found that the wait time (5 seconds) in multipathd > was not sufficient for the devices to appear in /dev/ It was taking about 20 > seconds. Changed the wait time to be 60 seconds. Change in patch 3/3. > > Please provide me with your feedback/comment on these changes regarding > correctness, completeness etc., > Looks very good. I merged the 3 patches. In 1/3, I changed the DEF_TIMEOUT name to avoid surcharging the one in checker.h I'm having a hard time push to kernel.org, so don't expect to see the git tree updated soon. Thanks, cvaroqui ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac 2007-03-21 23:06 ` [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Christophe Varoqui @ 2007-03-22 22:52 ` Bernd Zeimetz 2007-03-22 23:45 ` Chandra Seetharaman 1 sibling, 0 replies; 7+ messages in thread From: Bernd Zeimetz @ 2007-03-22 22:52 UTC (permalink / raw) To: device-mapper development Hi, > I'm having a hard time push to kernel.org, so don't expect to see the > git tree updated soon. > hmm. git.kernel.org seems to work well, at least to get stuff - I have nothing to push. Is there any other place where one could grab the latest multipath-tools, and probably recent kernel modules to test? Thanks, -- Bernd Zeimetz <bernd@bzed.de> <http://bzed.de/> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac 2007-03-21 23:06 ` [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Christophe Varoqui 2007-03-22 22:52 ` Bernd Zeimetz @ 2007-03-22 23:45 ` Chandra Seetharaman 1 sibling, 0 replies; 7+ messages in thread From: Chandra Seetharaman @ 2007-03-22 23:45 UTC (permalink / raw) To: Christophe Varoqui; +Cc: Mike Anderson, dm-devel, michaelc, agk Cool, Thanks. chandra On Thu, 2007-03-22 at 00:06 +0100, Christophe Varoqui wrote: > Le mercredi 21 mars 2007 à 11:38 -0800, Chandra Seetharaman a écrit : > > Hi All, > > > > While working on lsi-rdac hardware handler, I found that the checkers "tur" > > and "readsector0" are not serving the lsi-rdac properly. Also, the storage > > device has a active/passive state which need to be handled properly. > > > > So, I wrote a new path checker for lsi-rdac, to use the C4 inquiry page to get > > the current owner of the lun and set the state as UP(active) or GHOST(passive). > > Changes are in patch 1/3. > > > > After applying the above patch, I realized the priorities are not set properly. > > Made some changes to use the GHOST state while setting priorities. Changes are > > in patch 2/3. > > > > Debugging the above patches found that the wait time (5 seconds) in multipathd > > was not sufficient for the devices to appear in /dev/ It was taking about 20 > > seconds. Changed the wait time to be 60 seconds. Change in patch 3/3. > > > > Please provide me with your feedback/comment on these changes regarding > > correctness, completeness etc., > > > Looks very good. I merged the 3 patches. > > In 1/3, I changed the DEF_TIMEOUT name to avoid surcharging the one in > checker.h > > I'm having a hard time push to kernel.org, so don't expect to see the > git tree updated soon. > > Thanks, > cvaroqui > -- ---------------------------------------------------------------------- Chandra Seetharaman | Be careful what you choose.... - sekharan@us.ibm.com | .......you may get it. ---------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-03-22 23:45 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-03-21 19:38 [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 1/3] C4 Inquiry based path checker Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 2/3] Fix the priority calculation to use PATH_GHOST state Chandra Seetharaman 2007-03-21 19:38 ` [PATCH 3/3] Increase the wait time for device to appear in /dev Chandra Seetharaman 2007-03-21 23:06 ` [PATCH 0/3] Changes to Userspace multipath code to support lsi-rdac Christophe Varoqui 2007-03-22 22:52 ` Bernd Zeimetz 2007-03-22 23:45 ` Chandra Seetharaman
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.