]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - multipath-tools/patches/0069-UPBZ-1033791-improve-rdac-checker.patch
multipath-tools: Update to snapshot from 2013-02-22
[people/amarx/ipfire-3.x.git] / multipath-tools / patches / 0069-UPBZ-1033791-improve-rdac-checker.patch
1 ---
2 libmultipath/checkers/rdac.c | 91 ++++++++++++++++++++++++++++++++++++++-----
3 libmultipath/discovery.c | 2
4 2 files changed, 81 insertions(+), 12 deletions(-)
5
6 Index: multipath-tools-130222/libmultipath/checkers/rdac.c
7 ===================================================================
8 --- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
9 +++ multipath-tools-130222/libmultipath/checkers/rdac.c
10 @@ -34,6 +34,18 @@
11 #define MSG_RDAC_UP "rdac checker reports path is up"
12 #define MSG_RDAC_DOWN "rdac checker reports path is down"
13 #define MSG_RDAC_GHOST "rdac checker reports path is ghost"
14 +#define MSG_RDAC_DOWN_TYPE(STR) MSG_RDAC_DOWN": "STR
15 +
16 +#define RTPG_UNAVAILABLE 0x3
17 +#define RTPG_OFFLINE 0xE
18 +#define RTPG_TRANSITIONING 0xF
19 +
20 +#define RTPG_UNAVAIL_NON_RESPONSIVE 0x2
21 +#define RTPG_UNAVAIL_IN_RESET 0x3
22 +#define RTPG_UNAVAIL_CFW_DL1 0x4
23 +#define RTPG_UNAVAIL_CFW_DL2 0x5
24 +#define RTPG_UNAVAIL_QUIESCED 0x6
25 +#define RTPG_UNAVAIL_SERVICE_MODE 0x7
26
27 struct control_mode_page {
28 unsigned char header[8];
29 @@ -199,22 +211,64 @@ struct volume_access_inq
30 char PQ_PDT;
31 char dontcare0[7];
32 char avtcvp;
33 - char dontcare1;
34 - char asym_access_state_cur;
35 + char vol_ppp;
36 + char aas_cur;
37 char vendor_specific_cur;
38 - char dontcare2[36];
39 + char aas_alt;
40 + char vendor_specific_alt;
41 + char dontcare1[34];
42 };
43
44 +const char
45 +*checker_msg_string(struct volume_access_inq *inq)
46 +{
47 + /* lun not connected */
48 + if (((inq->PQ_PDT & 0xE0) == 0x20) || (inq->PQ_PDT & 0x7f))
49 + return MSG_RDAC_DOWN_TYPE("lun not connected");
50 +
51 + /* if no tpg data is available, give the generic path down message */
52 + if (!(inq->avtcvp & 0x10))
53 + return MSG_RDAC_DOWN;
54 +
55 + /* controller is booting up */
56 + if (((inq->aas_cur & 0x0F) == RTPG_TRANSITIONING) &&
57 + (inq->aas_alt & 0x0F) != RTPG_TRANSITIONING)
58 + return MSG_RDAC_DOWN_TYPE("ctlr is in startup sequence");
59 +
60 + /* if not unavailable, give generic message */
61 + if ((inq->aas_cur & 0x0F) != RTPG_UNAVAILABLE)
62 + return MSG_RDAC_DOWN;
63 +
64 + /* target port group unavailable */
65 + switch (inq->vendor_specific_cur) {
66 + case RTPG_UNAVAIL_NON_RESPONSIVE:
67 + return MSG_RDAC_DOWN_TYPE("non-responsive to queries");
68 + case RTPG_UNAVAIL_IN_RESET:
69 + return MSG_RDAC_DOWN_TYPE("ctlr held in reset");
70 + case RTPG_UNAVAIL_CFW_DL1:
71 + case RTPG_UNAVAIL_CFW_DL2:
72 + return MSG_RDAC_DOWN_TYPE("ctlr firmware downloading");
73 + case RTPG_UNAVAIL_QUIESCED:
74 + return MSG_RDAC_DOWN_TYPE("ctlr quiesced by admin request");
75 + case RTPG_UNAVAIL_SERVICE_MODE:
76 + return MSG_RDAC_DOWN_TYPE("ctlr is in service mode");
77 + default:
78 + return MSG_RDAC_DOWN_TYPE("ctlr is unavailable");
79 + }
80 +}
81 +
82 extern int
83 libcheck_check (struct checker * c)
84 {
85 struct volume_access_inq inq;
86 - int ret;
87 + int ret, inqfail;
88
89 + inqfail = 0;
90 memset(&inq, 0, sizeof(struct volume_access_inq));
91 if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq),
92 c->timeout)) {
93 ret = PATH_DOWN;
94 + inqfail = 1;
95 goto done;
96 } else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) {
97 /* LUN not connected*/
98 @@ -222,11 +276,27 @@ libcheck_check (struct checker * c)
99 goto done;
100 }
101
102 - /* check if controller is reporting asymmetric access state of unavailable */
103 - if ((inq.avtcvp & 0x10) &&
104 - ((inq.asym_access_state_cur & 0x0F) == 0x3)) {
105 - ret = PATH_DOWN;
106 - goto done;
107 + /* If TPGDE bit set, evaluate TPG information */
108 + if ((inq.avtcvp & 0x10)) {
109 + switch (inq.aas_cur & 0x0F) {
110 + /* Never use the path if it reports unavailable */
111 + case RTPG_UNAVAILABLE:
112 + ret = PATH_DOWN;
113 + goto done;
114 + /*
115 + * If both controllers report transitioning, it
116 + * means mode select or STPG is being processed.
117 + *
118 + * If this controller alone is transitioning, it's
119 + * booting and we shouldn't use it yet.
120 + */
121 + case RTPG_TRANSITIONING:
122 + if ((inq.aas_alt & 0xF) != RTPG_TRANSITIONING) {
123 + ret = PATH_DOWN;
124 + goto done;
125 + }
126 + break;
127 + }
128 }
129
130 /* If owner set or ioship mode is enabled return PATH_UP always */
131 @@ -238,7 +308,8 @@ libcheck_check (struct checker * c)
132 done:
133 switch (ret) {
134 case PATH_DOWN:
135 - MSG(c, MSG_RDAC_DOWN);
136 + MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
137 + checker_msg_string(&inq));
138 break;
139 case PATH_UP:
140 MSG(c, MSG_RDAC_UP);
141 Index: multipath-tools-130222/libmultipath/discovery.c
142 ===================================================================
143 --- multipath-tools-130222.orig/libmultipath/discovery.c
144 +++ multipath-tools-130222/libmultipath/discovery.c
145 @@ -1116,8 +1116,6 @@ pathinfo (struct path *pp, vector hwtabl
146 if (!strlen(pp->wwid))
147 get_uid(pp);
148 get_prio(pp);
149 - } else {
150 - pp->priority = PRIO_UNDEF;
151 }
152 }
153