Merge ~paelzer/ubuntu/+source/libiscsi:fix-FTBFS-1894129-GROOVY into ubuntu/+source/libiscsi:ubuntu/groovy-devel
- Git
- lp:~paelzer/ubuntu/+source/libiscsi
- fix-FTBFS-1894129-GROOVY
- Merge into ubuntu/groovy-devel
Proposed by
Christian Ehrhardt
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Christian Ehrhardt | ||||
Approved revision: | d2755eb1d7db1a44da9a35b5c71c87bf06c2eaac | ||||
Merged at revision: | d2755eb1d7db1a44da9a35b5c71c87bf06c2eaac | ||||
Proposed branch: | ~paelzer/ubuntu/+source/libiscsi:fix-FTBFS-1894129-GROOVY | ||||
Merge into: | ubuntu/+source/libiscsi:ubuntu/groovy-devel | ||||
Diff against target: |
989 lines (+889/-1) 15 files modified
debian/changelog (+6/-0) debian/control (+2/-1) debian/patches/lp-1894129-test-tool-BlockEraseReserved-override-driver-queue_p.patch (+74/-0) debian/patches/lp-1894129-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch (+39/-0) debian/patches/lp-1894129-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch (+71/-0) debian/patches/lp-1894129-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch (+39/-0) debian/patches/lp-1894129-test-tool-CryptoEraseReserved-override-driver-queue_.patch (+74/-0) debian/patches/lp-1894129-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch (+39/-0) debian/patches/lp-1894129-test-tool-OverwriteReserved-override-driver-queue_pd.patch (+68/-0) debian/patches/lp-1894129-test-tool-Use-extern-int-in-headers.patch (+58/-0) debian/patches/lp-1894129-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch (+68/-0) debian/patches/lp-1894129-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch (+69/-0) debian/patches/lp-1894129-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch (+166/-0) debian/patches/lp-1894129-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch (+104/-0) debian/patches/series (+12/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lucas Kanashiro (community) | Approve | ||
Canonical Server | Pending | ||
Canonical Server packageset reviewers | Pending | ||
Review via email: mp+390397@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt (paelzer) wrote : | # |
Revision history for this message
Christian Ehrhardt (paelzer) wrote : | # |
Also submitted to https:/
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : | # |
LGTM, +1.
review:
Approve
Revision history for this message
Christian Ehrhardt (paelzer) wrote : | # |
Thanks!
* [new tag] upload/
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading libiscsi_
Uploading libiscsi_
Uploading libiscsi_
Uploading libiscsi_
Successfully uploaded packages.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 096d70b..bf25cdc 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,9 @@ | |||
6 | 1 | libiscsi (1.19.0-2ubuntu1) groovy; urgency=medium | ||
7 | 2 | |||
8 | 3 | * d/p/lp-1894129-*: fix FTBFS (LP: #1894129) | ||
9 | 4 | |||
10 | 5 | -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Tue, 08 Sep 2020 14:31:03 +0200 | ||
11 | 6 | |||
12 | 1 | libiscsi (1.19.0-2) unstable; urgency=medium | 7 | libiscsi (1.19.0-2) unstable; urgency=medium |
13 | 2 | 8 | ||
14 | 3 | * attribute_packed.patch (Closes: #966864) | 9 | * attribute_packed.patch (Closes: #966864) |
15 | diff --git a/debian/control b/debian/control | |||
16 | index 9310439..50f39ed 100644 | |||
17 | --- a/debian/control | |||
18 | +++ b/debian/control | |||
19 | @@ -1,7 +1,8 @@ | |||
20 | 1 | Source: libiscsi | 1 | Source: libiscsi |
21 | 2 | Section: net | 2 | Section: net |
22 | 3 | Priority: optional | 3 | Priority: optional |
24 | 4 | Maintainer: Michael Tokarev <mjt@tls.msk.ru> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
25 | 5 | XSBC-Original-Maintainer: Michael Tokarev <mjt@tls.msk.ru> | ||
26 | 5 | Build-Depends: debhelper-compat (= 12), libcunit1-dev, librdmacm-dev | 6 | Build-Depends: debhelper-compat (= 12), libcunit1-dev, librdmacm-dev |
27 | 6 | Rules-Requires-Root: no | 7 | Rules-Requires-Root: no |
28 | 7 | Standards-Version: 4.5.0 | 8 | Standards-Version: 4.5.0 |
29 | diff --git a/debian/patches/lp-1894129-test-tool-BlockEraseReserved-override-driver-queue_p.patch b/debian/patches/lp-1894129-test-tool-BlockEraseReserved-override-driver-queue_p.patch | |||
30 | 8 | new file mode 100644 | 9 | new file mode 100644 |
31 | index 0000000..68def73 | |||
32 | --- /dev/null | |||
33 | +++ b/debian/patches/lp-1894129-test-tool-BlockEraseReserved-override-driver-queue_p.patch | |||
34 | @@ -0,0 +1,74 @@ | |||
35 | 1 | From b705f9e5240583fb862f16d603e5cf2120e5d54c Mon Sep 17 00:00:00 2001 | ||
36 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
37 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
38 | 4 | Subject: [PATCH] test-tool/BlockEraseReserved: override driver queue_pdu() | ||
39 | 5 | callback | ||
40 | 6 | |||
41 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
42 | 8 | overload hack, convert this test to use the regular transport driver | ||
43 | 9 | callback for this purpose. | ||
44 | 10 | |||
45 | 11 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
46 | 12 | |||
47 | 13 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/b705f9e5 | ||
48 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
49 | 15 | Last-Update: 2020-09-08 | ||
50 | 16 | |||
51 | 17 | --- | ||
52 | 18 | test-tool/test_sanitize_block_erase_reserved.c | 17 +++++++++++------ | ||
53 | 19 | 1 file changed, 11 insertions(+), 6 deletions(-) | ||
54 | 20 | |||
55 | 21 | diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c | ||
56 | 22 | index fcb862e..4a0d2cb 100644 | ||
57 | 23 | --- a/test-tool/test_sanitize_block_erase_reserved.c | ||
58 | 24 | +++ b/test-tool/test_sanitize_block_erase_reserved.c | ||
59 | 25 | @@ -25,8 +25,9 @@ | ||
60 | 26 | #include "iscsi-test-cu.h" | ||
61 | 27 | |||
62 | 28 | static int change_num; | ||
63 | 29 | +static struct iscsi_transport iscsi_drv_orig; | ||
64 | 30 | |||
65 | 31 | -static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) | ||
66 | 32 | +static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
67 | 33 | { | ||
68 | 34 | switch (change_num) { | ||
69 | 35 | case 1: | ||
70 | 36 | @@ -43,12 +44,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu | ||
71 | 37 | break; | ||
72 | 38 | } | ||
73 | 39 | |||
74 | 40 | - change_num = 0; | ||
75 | 41 | - return 0; | ||
76 | 42 | + change_num = 0; | ||
77 | 43 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
78 | 44 | } | ||
79 | 45 | |||
80 | 46 | void test_sanitize_block_erase_reserved(void) | ||
81 | 47 | -{ | ||
82 | 48 | +{ | ||
83 | 49 | int i; | ||
84 | 50 | |||
85 | 51 | logging(LOG_VERBOSE, LOG_BLANK_LINE); | ||
86 | 52 | @@ -64,8 +65,9 @@ void test_sanitize_block_erase_reserved(void) | ||
87 | 53 | return; | ||
88 | 54 | } | ||
89 | 55 | |||
90 | 56 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
91 | 57 | - | ||
92 | 58 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
93 | 59 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
94 | 60 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
95 | 61 | |||
96 | 62 | logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " | ||
97 | 63 | "bit in byte 1 set to 1"); | ||
98 | 64 | @@ -81,4 +83,7 @@ void test_sanitize_block_erase_reserved(void) | ||
99 | 65 | SANITIZE(sd, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL, | ||
100 | 66 | EXPECT_INVALID_FIELD_IN_CDB); | ||
101 | 67 | } | ||
102 | 68 | + | ||
103 | 69 | + /* restore transport callbacks */ | ||
104 | 70 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
105 | 71 | } | ||
106 | 72 | -- | ||
107 | 73 | 2.28.0 | ||
108 | 74 | |||
109 | diff --git a/debian/patches/lp-1894129-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch b/debian/patches/lp-1894129-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch | |||
110 | 0 | new file mode 100644 | 75 | new file mode 100644 |
111 | index 0000000..43ae51b | |||
112 | --- /dev/null | |||
113 | +++ b/debian/patches/lp-1894129-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch | |||
114 | @@ -0,0 +1,39 @@ | |||
115 | 1 | From fdc45fadfa06f2543a12abe8eefe7f87d5dab0c2 Mon Sep 17 00:00:00 2001 | ||
116 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
117 | 3 | Date: Mon, 16 Sep 2019 15:40:00 +0200 | ||
118 | 4 | Subject: [PATCH] test-tool/BlockEraseReserved: skip unless iSCSI | ||
119 | 5 | |||
120 | 6 | This test performs PDU manipulation so should only be run against iSCSI | ||
121 | 7 | devices. | ||
122 | 8 | |||
123 | 9 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
124 | 10 | |||
125 | 11 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/fdc45fad | ||
126 | 12 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
127 | 13 | Last-Update: 2020-09-08 | ||
128 | 14 | |||
129 | 15 | --- | ||
130 | 16 | test-tool/test_sanitize_block_erase_reserved.c | 7 +++++++ | ||
131 | 17 | 1 file changed, 7 insertions(+) | ||
132 | 18 | |||
133 | 19 | diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c | ||
134 | 20 | index 55c85d9..fcb862e 100644 | ||
135 | 21 | --- a/test-tool/test_sanitize_block_erase_reserved.c | ||
136 | 22 | +++ b/test-tool/test_sanitize_block_erase_reserved.c | ||
137 | 23 | @@ -56,6 +56,13 @@ void test_sanitize_block_erase_reserved(void) | ||
138 | 24 | |||
139 | 25 | CHECK_FOR_SANITIZE; | ||
140 | 26 | CHECK_FOR_DATALOSS; | ||
141 | 27 | + if (sd->iscsi_ctx == NULL) { | ||
142 | 28 | + const char *err = "[SKIPPED] This test is " | ||
143 | 29 | + "only supported for iSCSI backends"; | ||
144 | 30 | + logging(LOG_NORMAL, "%s", err); | ||
145 | 31 | + CU_PASS(err); | ||
146 | 32 | + return; | ||
147 | 33 | + } | ||
148 | 34 | |||
149 | 35 | local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
150 | 36 | |||
151 | 37 | -- | ||
152 | 38 | 2.28.0 | ||
153 | 39 | |||
154 | diff --git a/debian/patches/lp-1894129-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch b/debian/patches/lp-1894129-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch | |||
155 | 0 | new file mode 100644 | 40 | new file mode 100644 |
156 | index 0000000..d0433a2 | |||
157 | --- /dev/null | |||
158 | +++ b/debian/patches/lp-1894129-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch | |||
159 | @@ -0,0 +1,71 @@ | |||
160 | 1 | From 310e9ace02bafb78d69bfe20e5c9befe7ed24a10 Mon Sep 17 00:00:00 2001 | ||
161 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
162 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
163 | 4 | Subject: [PATCH] test-tool/Compare&Write: override driver queue_pdu() callback | ||
164 | 5 | |||
165 | 6 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
166 | 7 | overload hack, convert the Compare&Write InvalidDataOutSize test to use | ||
167 | 8 | the regular transport driver callback for this purpose. | ||
168 | 9 | |||
169 | 10 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
170 | 11 | |||
171 | 12 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/310e9ace | ||
172 | 13 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
173 | 14 | Last-Update: 2020-09-08 | ||
174 | 15 | |||
175 | 16 | --- | ||
176 | 17 | .../test_compareandwrite_invalid_dataout_size.c | 16 +++++++++++----- | ||
177 | 18 | 1 file changed, 11 insertions(+), 5 deletions(-) | ||
178 | 19 | |||
179 | 20 | diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
180 | 21 | index eb6a6dd..9fcd739 100644 | ||
181 | 22 | --- a/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
182 | 23 | +++ b/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
183 | 24 | @@ -27,11 +27,12 @@ | ||
184 | 25 | |||
185 | 26 | |||
186 | 27 | static int new_tl; | ||
187 | 28 | +static struct iscsi_transport iscsi_drv_orig; | ||
188 | 29 | |||
189 | 30 | -static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu _U_) | ||
190 | 31 | +static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
191 | 32 | { | ||
192 | 33 | if (pdu->outdata.data[0] != ISCSI_PDU_SCSI_REQUEST) { | ||
193 | 34 | - return 0; | ||
194 | 35 | + goto out; | ||
195 | 36 | } | ||
196 | 37 | switch (new_tl) { | ||
197 | 38 | case 1: | ||
198 | 39 | @@ -43,7 +44,8 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu | ||
199 | 40 | pdu->outdata.data[32 + 13] = 3; | ||
200 | 41 | break; | ||
201 | 42 | } | ||
202 | 43 | - return 0; | ||
203 | 44 | +out: | ||
204 | 45 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
205 | 46 | } | ||
206 | 47 | |||
207 | 48 | void | ||
208 | 49 | @@ -61,8 +63,10 @@ test_compareandwrite_invalid_dataout_size(void) | ||
209 | 50 | return; | ||
210 | 51 | } | ||
211 | 52 | |||
212 | 53 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
213 | 54 | - | ||
214 | 55 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
215 | 56 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
216 | 57 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
217 | 58 | + | ||
218 | 59 | logging(LOG_VERBOSE, LOG_BLANK_LINE); | ||
219 | 60 | logging(LOG_VERBOSE, "Test that COMPAREANDWRITE fails for invalid " | ||
220 | 61 | "(too small/too large) DataOut sizes."); | ||
221 | 62 | @@ -89,4 +93,6 @@ test_compareandwrite_invalid_dataout_size(void) | ||
222 | 63 | block_size, 0, 0, 0, 0, | ||
223 | 64 | EXPECT_STATUS_GENERIC_BAD); | ||
224 | 65 | |||
225 | 66 | + /* restore transport callbacks */ | ||
226 | 67 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
227 | 68 | } | ||
228 | 69 | -- | ||
229 | 70 | 2.28.0 | ||
230 | 71 | |||
231 | diff --git a/debian/patches/lp-1894129-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch b/debian/patches/lp-1894129-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch | |||
232 | 0 | new file mode 100644 | 72 | new file mode 100644 |
233 | index 0000000..179a622 | |||
234 | --- /dev/null | |||
235 | +++ b/debian/patches/lp-1894129-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch | |||
236 | @@ -0,0 +1,39 @@ | |||
237 | 1 | From 60a5856f00731be578a57bfbf68b2e9858680f07 Mon Sep 17 00:00:00 2001 | ||
238 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
239 | 3 | Date: Mon, 16 Sep 2019 14:33:50 +0200 | ||
240 | 4 | Subject: [PATCH] test-tool/Compare&Write: skip InvalidDataOutSize unless iSCSI | ||
241 | 5 | |||
242 | 6 | This test performs PDU manipulation so should only be run against iSCSI | ||
243 | 7 | devices. | ||
244 | 8 | |||
245 | 9 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
246 | 10 | |||
247 | 11 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/60a5856f | ||
248 | 12 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
249 | 13 | Last-Update: 2020-09-08 | ||
250 | 14 | |||
251 | 15 | --- | ||
252 | 16 | test-tool/test_compareandwrite_invalid_dataout_size.c | 7 +++++++ | ||
253 | 17 | 1 file changed, 7 insertions(+) | ||
254 | 18 | |||
255 | 19 | diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
256 | 20 | index 4abd501..eb6a6dd 100644 | ||
257 | 21 | --- a/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
258 | 22 | +++ b/test-tool/test_compareandwrite_invalid_dataout_size.c | ||
259 | 23 | @@ -53,6 +53,13 @@ test_compareandwrite_invalid_dataout_size(void) | ||
260 | 24 | CHECK_FOR_THIN_PROVISIONING; | ||
261 | 25 | CHECK_FOR_LBPPB_GT_1; | ||
262 | 26 | CHECK_FOR_SBC; | ||
263 | 27 | + if (sd->iscsi_ctx == NULL) { | ||
264 | 28 | + const char *err = "[SKIPPED] This test is " | ||
265 | 29 | + "only supported for iSCSI backends"; | ||
266 | 30 | + logging(LOG_NORMAL, "%s", err); | ||
267 | 31 | + CU_PASS(err); | ||
268 | 32 | + return; | ||
269 | 33 | + } | ||
270 | 34 | |||
271 | 35 | local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
272 | 36 | |||
273 | 37 | -- | ||
274 | 38 | 2.28.0 | ||
275 | 39 | |||
276 | diff --git a/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-override-driver-queue_.patch b/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-override-driver-queue_.patch | |||
277 | 0 | new file mode 100644 | 40 | new file mode 100644 |
278 | index 0000000..0c4a300 | |||
279 | --- /dev/null | |||
280 | +++ b/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-override-driver-queue_.patch | |||
281 | @@ -0,0 +1,74 @@ | |||
282 | 1 | From 77279dd44fd19167c22cfada2eec377058e1bde9 Mon Sep 17 00:00:00 2001 | ||
283 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
284 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
285 | 4 | Subject: [PATCH] test-tool/CryptoEraseReserved: override driver queue_pdu() | ||
286 | 5 | callback | ||
287 | 6 | |||
288 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
289 | 8 | overload hack, convert this test to use the regular transport driver | ||
290 | 9 | callback for this purpose. | ||
291 | 10 | |||
292 | 11 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
293 | 12 | |||
294 | 13 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/77279dd4 | ||
295 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
296 | 15 | Last-Update: 2020-09-08 | ||
297 | 16 | |||
298 | 17 | --- | ||
299 | 18 | test-tool/test_sanitize_crypto_erase_reserved.c | 17 +++++++++++------ | ||
300 | 19 | 1 file changed, 11 insertions(+), 6 deletions(-) | ||
301 | 20 | |||
302 | 21 | diff --git a/test-tool/test_sanitize_crypto_erase_reserved.c b/test-tool/test_sanitize_crypto_erase_reserved.c | ||
303 | 22 | index 00bbf34..646cbea 100644 | ||
304 | 23 | --- a/test-tool/test_sanitize_crypto_erase_reserved.c | ||
305 | 24 | +++ b/test-tool/test_sanitize_crypto_erase_reserved.c | ||
306 | 25 | @@ -25,8 +25,9 @@ | ||
307 | 26 | #include "iscsi-test-cu.h" | ||
308 | 27 | |||
309 | 28 | static int change_num; | ||
310 | 29 | +static struct iscsi_transport iscsi_drv_orig; | ||
311 | 30 | |||
312 | 31 | -static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) | ||
313 | 32 | +static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
314 | 33 | { | ||
315 | 34 | switch (change_num) { | ||
316 | 35 | case 1: | ||
317 | 36 | @@ -43,12 +44,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu | ||
318 | 37 | break; | ||
319 | 38 | } | ||
320 | 39 | |||
321 | 40 | - change_num = 0; | ||
322 | 41 | - return 0; | ||
323 | 42 | + change_num = 0; | ||
324 | 43 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
325 | 44 | } | ||
326 | 45 | |||
327 | 46 | void test_sanitize_crypto_erase_reserved(void) | ||
328 | 47 | -{ | ||
329 | 48 | +{ | ||
330 | 49 | int i; | ||
331 | 50 | |||
332 | 51 | logging(LOG_VERBOSE, LOG_BLANK_LINE); | ||
333 | 52 | @@ -64,8 +65,9 @@ void test_sanitize_crypto_erase_reserved(void) | ||
334 | 53 | return; | ||
335 | 54 | } | ||
336 | 55 | |||
337 | 56 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
338 | 57 | - | ||
339 | 58 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
340 | 59 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
341 | 60 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
342 | 61 | |||
343 | 62 | logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " | ||
344 | 63 | "bit in byte 1 set to 1"); | ||
345 | 64 | @@ -81,4 +83,7 @@ void test_sanitize_crypto_erase_reserved(void) | ||
346 | 65 | SANITIZE(sd, 0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL, | ||
347 | 66 | EXPECT_INVALID_FIELD_IN_CDB); | ||
348 | 67 | } | ||
349 | 68 | + | ||
350 | 69 | + /* restore transport callbacks */ | ||
351 | 70 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
352 | 71 | } | ||
353 | 72 | -- | ||
354 | 73 | 2.28.0 | ||
355 | 74 | |||
356 | diff --git a/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch b/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch | |||
357 | 0 | new file mode 100644 | 75 | new file mode 100644 |
358 | index 0000000..95ca3a3 | |||
359 | --- /dev/null | |||
360 | +++ b/debian/patches/lp-1894129-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch | |||
361 | @@ -0,0 +1,39 @@ | |||
362 | 1 | From c830a3b55e91fe8b1cb97e6899ef872691c8804e Mon Sep 17 00:00:00 2001 | ||
363 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
364 | 3 | Date: Mon, 16 Sep 2019 15:40:00 +0200 | ||
365 | 4 | Subject: [PATCH] test-tool/CryptoEraseReserved: skip unless iSCSI | ||
366 | 5 | |||
367 | 6 | This test performs PDU manipulation so should only be run against iSCSI | ||
368 | 7 | devices. | ||
369 | 8 | |||
370 | 9 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
371 | 10 | |||
372 | 11 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/c830a3b5 | ||
373 | 12 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
374 | 13 | Last-Update: 2020-09-08 | ||
375 | 14 | |||
376 | 15 | --- | ||
377 | 16 | test-tool/test_sanitize_crypto_erase_reserved.c | 7 +++++++ | ||
378 | 17 | 1 file changed, 7 insertions(+) | ||
379 | 18 | |||
380 | 19 | diff --git a/test-tool/test_sanitize_crypto_erase_reserved.c b/test-tool/test_sanitize_crypto_erase_reserved.c | ||
381 | 20 | index c713ab5..00bbf34 100644 | ||
382 | 21 | --- a/test-tool/test_sanitize_crypto_erase_reserved.c | ||
383 | 22 | +++ b/test-tool/test_sanitize_crypto_erase_reserved.c | ||
384 | 23 | @@ -56,6 +56,13 @@ void test_sanitize_crypto_erase_reserved(void) | ||
385 | 24 | |||
386 | 25 | CHECK_FOR_SANITIZE; | ||
387 | 26 | CHECK_FOR_DATALOSS; | ||
388 | 27 | + if (sd->iscsi_ctx == NULL) { | ||
389 | 28 | + const char *err = "[SKIPPED] This test is " | ||
390 | 29 | + "only supported for iSCSI backends"; | ||
391 | 30 | + logging(LOG_NORMAL, "%s", err); | ||
392 | 31 | + CU_PASS(err); | ||
393 | 32 | + return; | ||
394 | 33 | + } | ||
395 | 34 | |||
396 | 35 | local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
397 | 36 | |||
398 | 37 | -- | ||
399 | 38 | 2.28.0 | ||
400 | 39 | |||
401 | diff --git a/debian/patches/lp-1894129-test-tool-OverwriteReserved-override-driver-queue_pd.patch b/debian/patches/lp-1894129-test-tool-OverwriteReserved-override-driver-queue_pd.patch | |||
402 | 0 | new file mode 100644 | 40 | new file mode 100644 |
403 | index 0000000..0b6e27b | |||
404 | --- /dev/null | |||
405 | +++ b/debian/patches/lp-1894129-test-tool-OverwriteReserved-override-driver-queue_pd.patch | |||
406 | @@ -0,0 +1,68 @@ | |||
407 | 1 | From 2ae45ac15d8c1d4a4f68a085dadb7f43e2f2e280 Mon Sep 17 00:00:00 2001 | ||
408 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
409 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
410 | 4 | Subject: [PATCH] test-tool/OverwriteReserved: override driver queue_pdu() | ||
411 | 5 | callback | ||
412 | 6 | |||
413 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
414 | 8 | overload hack, convert this test to use the regular transport driver | ||
415 | 9 | callback for this purpose. | ||
416 | 10 | |||
417 | 11 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
418 | 12 | |||
419 | 13 | Origin: backport, https://github.com/sahlberg/libiscsi/commit/2ae45ac1 | ||
420 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
421 | 15 | Last-Update: 2020-09-08 | ||
422 | 16 | |||
423 | 17 | --- | ||
424 | 18 | test-tool/test_sanitize_overwrite_reserved.c | 16 +++++++++++----- | ||
425 | 19 | 1 file changed, 11 insertions(+), 5 deletions(-) | ||
426 | 20 | |||
427 | 21 | --- a/test-tool/test_sanitize_overwrite_reserved.c | ||
428 | 22 | +++ b/test-tool/test_sanitize_overwrite_reserved.c | ||
429 | 23 | @@ -26,8 +26,9 @@ | ||
430 | 24 | #include "iscsi-test-cu.h" | ||
431 | 25 | |||
432 | 26 | static int change_num; | ||
433 | 27 | +static struct iscsi_transport iscsi_drv_orig; | ||
434 | 28 | |||
435 | 29 | -static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) | ||
436 | 30 | +static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
437 | 31 | { | ||
438 | 32 | switch (change_num) { | ||
439 | 33 | case 1: | ||
440 | 34 | @@ -44,12 +45,12 @@ static int my_iscsi_queue_pdu(struct isc | ||
441 | 35 | break; | ||
442 | 36 | } | ||
443 | 37 | |||
444 | 38 | - change_num = 0; | ||
445 | 39 | - return 0; | ||
446 | 40 | + change_num = 0; | ||
447 | 41 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
448 | 42 | } | ||
449 | 43 | |||
450 | 44 | void test_sanitize_overwrite_reserved(void) | ||
451 | 45 | -{ | ||
452 | 46 | +{ | ||
453 | 47 | int i; | ||
454 | 48 | struct iscsi_data data; | ||
455 | 49 | |||
456 | 50 | @@ -68,7 +69,9 @@ void test_sanitize_overwrite_reserved(vo | ||
457 | 51 | CHECK_FOR_SANITIZE; | ||
458 | 52 | CHECK_FOR_DATALOSS; | ||
459 | 53 | |||
460 | 54 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
461 | 55 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
462 | 56 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
463 | 57 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
464 | 58 | |||
465 | 59 | logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " | ||
466 | 60 | "bit in byte 1 set to 1"); | ||
467 | 61 | @@ -84,4 +87,7 @@ void test_sanitize_overwrite_reserved(vo | ||
468 | 62 | SANITIZE(sd, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data, | ||
469 | 63 | EXPECT_INVALID_FIELD_IN_CDB); | ||
470 | 64 | } | ||
471 | 65 | + | ||
472 | 66 | + /* restore transport callbacks */ | ||
473 | 67 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
474 | 68 | } | ||
475 | diff --git a/debian/patches/lp-1894129-test-tool-Use-extern-int-in-headers.patch b/debian/patches/lp-1894129-test-tool-Use-extern-int-in-headers.patch | |||
476 | 0 | new file mode 100644 | 69 | new file mode 100644 |
477 | index 0000000..f10a7a4 | |||
478 | --- /dev/null | |||
479 | +++ b/debian/patches/lp-1894129-test-tool-Use-extern-int-in-headers.patch | |||
480 | @@ -0,0 +1,58 @@ | |||
481 | 1 | From ea89dcdbf167acd634300296172926c2e8d85804 Mon Sep 17 00:00:00 2001 | ||
482 | 2 | From: Cole Robinson <crobinso@redhat.com> | ||
483 | 3 | Date: Sat, 15 Feb 2020 18:03:11 -0500 | ||
484 | 4 | Subject: [PATCH] test-tool: Use 'extern int' in headers | ||
485 | 5 | |||
486 | 6 | Without this, linking fails on Fedora rawhide. Example: | ||
487 | 7 | |||
488 | 8 | ... | ||
489 | 9 | /usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: multiple definition of `param_list_len_err_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: first defined here | ||
490 | 10 | /usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: multiple definition of `invalid_cdb_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: first defined here | ||
491 | 11 | ... | ||
492 | 12 | |||
493 | 13 | Signed-off-by: Cole Robinson <crobinso@redhat.com> | ||
494 | 14 | |||
495 | 15 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/ea89dcdb | ||
496 | 16 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
497 | 17 | Last-Update: 2020-09-08 | ||
498 | 18 | |||
499 | 19 | --- | ||
500 | 20 | test-tool/iscsi-support.h | 22 +++++++++++----------- | ||
501 | 21 | 1 file changed, 11 insertions(+), 11 deletions(-) | ||
502 | 22 | |||
503 | 23 | diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h | ||
504 | 24 | index 7aa9e45..9c3a461 100644 | ||
505 | 25 | --- a/test-tool/iscsi-support.h | ||
506 | 26 | +++ b/test-tool/iscsi-support.h | ||
507 | 27 | @@ -53,17 +53,17 @@ extern const char *initiatorname2; | ||
508 | 28 | #define EXPECT_RESERVATION_CONFLICT SCSI_STATUS_RESERVATION_CONFLICT, 0, NULL, 0 | ||
509 | 29 | #define EXPECT_COPY_ABORTED SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_COPY_ABORTED, copy_aborted_ascqs, 3 | ||
510 | 30 | |||
511 | 31 | -int no_medium_ascqs[3]; | ||
512 | 32 | -int lba_oob_ascqs[1]; | ||
513 | 33 | -int invalid_cdb_ascqs[2]; | ||
514 | 34 | -int param_list_len_err_ascqs[1]; | ||
515 | 35 | -int too_many_desc_ascqs[2]; | ||
516 | 36 | -int unsupp_desc_code_ascqs[2]; | ||
517 | 37 | -int write_protect_ascqs[3]; | ||
518 | 38 | -int sanitize_ascqs[1]; | ||
519 | 39 | -int removal_ascqs[1]; | ||
520 | 40 | -int miscompare_ascqs[1]; | ||
521 | 41 | -int copy_aborted_ascqs[3]; | ||
522 | 42 | +extern int no_medium_ascqs[3]; | ||
523 | 43 | +extern int lba_oob_ascqs[1]; | ||
524 | 44 | +extern int invalid_cdb_ascqs[2]; | ||
525 | 45 | +extern int param_list_len_err_ascqs[1]; | ||
526 | 46 | +extern int too_many_desc_ascqs[2]; | ||
527 | 47 | +extern int unsupp_desc_code_ascqs[2]; | ||
528 | 48 | +extern int write_protect_ascqs[3]; | ||
529 | 49 | +extern int sanitize_ascqs[1]; | ||
530 | 50 | +extern int removal_ascqs[1]; | ||
531 | 51 | +extern int miscompare_ascqs[1]; | ||
532 | 52 | +extern int copy_aborted_ascqs[3]; | ||
533 | 53 | |||
534 | 54 | extern int loglevel; | ||
535 | 55 | #define LOG_SILENT 0 | ||
536 | 56 | -- | ||
537 | 57 | 2.28.0 | ||
538 | 58 | |||
539 | diff --git a/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch b/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch | |||
540 | 0 | new file mode 100644 | 59 | new file mode 100644 |
541 | index 0000000..5df90d9 | |||
542 | --- /dev/null | |||
543 | +++ b/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch | |||
544 | @@ -0,0 +1,68 @@ | |||
545 | 1 | From 575ba2244c5db240bc29fa493404eee39f693a2d Mon Sep 17 00:00:00 2001 | ||
546 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
547 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
548 | 4 | Subject: [PATCH] test-tool/iSCSICmdSnTooHigh: override driver queue_pdu() | ||
549 | 5 | callback | ||
550 | 6 | |||
551 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
552 | 8 | overload hack, convert this test to use the regular transport driver | ||
553 | 9 | callback for this purpose. | ||
554 | 10 | |||
555 | 11 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
556 | 12 | |||
557 | 13 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/575ba224 | ||
558 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
559 | 15 | Last-Update: 2020-09-08 | ||
560 | 16 | |||
561 | 17 | --- | ||
562 | 18 | test-tool/test_iscsi_cmdsn_toohigh.c | 11 ++++++++--- | ||
563 | 19 | 1 file changed, 8 insertions(+), 3 deletions(-) | ||
564 | 20 | |||
565 | 21 | diff --git a/test-tool/test_iscsi_cmdsn_toohigh.c b/test-tool/test_iscsi_cmdsn_toohigh.c | ||
566 | 22 | index 59ce0ab..19c8b91 100644 | ||
567 | 23 | --- a/test-tool/test_iscsi_cmdsn_toohigh.c | ||
568 | 24 | +++ b/test-tool/test_iscsi_cmdsn_toohigh.c | ||
569 | 25 | @@ -25,6 +25,7 @@ | ||
570 | 26 | #include "iscsi-test-cu.h" | ||
571 | 27 | |||
572 | 28 | static int change_cmdsn; | ||
573 | 29 | +static struct iscsi_transport iscsi_drv_orig; | ||
574 | 30 | |||
575 | 31 | static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
576 | 32 | { | ||
577 | 33 | @@ -40,7 +41,7 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu | ||
578 | 34 | } | ||
579 | 35 | |||
580 | 36 | change_cmdsn = 0; | ||
581 | 37 | - return 0; | ||
582 | 38 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
583 | 39 | } | ||
584 | 40 | |||
585 | 41 | void test_iscsi_cmdsn_toohigh(void) | ||
586 | 42 | @@ -64,7 +65,9 @@ void test_iscsi_cmdsn_toohigh(void) | ||
587 | 43 | |||
588 | 44 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
589 | 45 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
590 | 46 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
591 | 47 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
592 | 48 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
593 | 49 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
594 | 50 | change_cmdsn = 1; | ||
595 | 51 | /* we don't want autoreconnect since some targets will incorrectly | ||
596 | 52 | * drop the connection on this condition. | ||
597 | 53 | @@ -81,9 +84,11 @@ void test_iscsi_cmdsn_toohigh(void) | ||
598 | 54 | logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window."); | ||
599 | 55 | } | ||
600 | 56 | |||
601 | 57 | - | ||
602 | 58 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
603 | 59 | logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); | ||
604 | 60 | TESTUNITREADY(sd, | ||
605 | 61 | EXPECT_STATUS_GOOD); | ||
606 | 62 | + | ||
607 | 63 | + /* restore transport callbacks */ | ||
608 | 64 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
609 | 65 | } | ||
610 | 66 | -- | ||
611 | 67 | 2.28.0 | ||
612 | 68 | |||
613 | diff --git a/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch b/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch | |||
614 | 0 | new file mode 100644 | 69 | new file mode 100644 |
615 | index 0000000..4dcd73d | |||
616 | --- /dev/null | |||
617 | +++ b/debian/patches/lp-1894129-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch | |||
618 | @@ -0,0 +1,69 @@ | |||
619 | 1 | From c067eef9c10c17b8a9be83ee4f71d4c8d0d238e4 Mon Sep 17 00:00:00 2001 | ||
620 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
621 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
622 | 4 | Subject: [PATCH] test-tool/iSCSICmdSnTooLow: override driver queue_pdu() | ||
623 | 5 | callback | ||
624 | 6 | |||
625 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
626 | 8 | overload hack, convert this test to use the regular transport driver | ||
627 | 9 | callback for this purpose. | ||
628 | 10 | |||
629 | 11 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
630 | 12 | |||
631 | 13 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/c067eef9 | ||
632 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
633 | 15 | Last-Update: 2020-09-08 | ||
634 | 16 | |||
635 | 17 | --- | ||
636 | 18 | test-tool/test_iscsi_cmdsn_toolow.c | 12 ++++++++---- | ||
637 | 19 | 1 file changed, 8 insertions(+), 4 deletions(-) | ||
638 | 20 | |||
639 | 21 | diff --git a/test-tool/test_iscsi_cmdsn_toolow.c b/test-tool/test_iscsi_cmdsn_toolow.c | ||
640 | 22 | index 0b980b3..23b93c3 100644 | ||
641 | 23 | --- a/test-tool/test_iscsi_cmdsn_toolow.c | ||
642 | 24 | +++ b/test-tool/test_iscsi_cmdsn_toolow.c | ||
643 | 25 | @@ -25,6 +25,7 @@ | ||
644 | 26 | #include "iscsi-test-cu.h" | ||
645 | 27 | |||
646 | 28 | static int change_cmdsn; | ||
647 | 29 | +static struct iscsi_transport iscsi_drv_orig; | ||
648 | 30 | |||
649 | 31 | static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
650 | 32 | { | ||
651 | 33 | @@ -40,7 +41,7 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu | ||
652 | 34 | } | ||
653 | 35 | |||
654 | 36 | change_cmdsn = 0; | ||
655 | 37 | - return 0; | ||
656 | 38 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
657 | 39 | } | ||
658 | 40 | |||
659 | 41 | void test_iscsi_cmdsn_toolow(void) | ||
660 | 42 | @@ -64,7 +65,9 @@ void test_iscsi_cmdsn_toolow(void) | ||
661 | 43 | |||
662 | 44 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
663 | 45 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
664 | 46 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
665 | 47 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
666 | 48 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
667 | 49 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
668 | 50 | change_cmdsn = 1; | ||
669 | 51 | /* we don't want autoreconnect since some targets will incorrectly | ||
670 | 52 | * drop the connection on this condition. | ||
671 | 53 | @@ -81,10 +84,11 @@ void test_iscsi_cmdsn_toolow(void) | ||
672 | 54 | logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window."); | ||
673 | 55 | } | ||
674 | 56 | |||
675 | 57 | - | ||
676 | 58 | - | ||
677 | 59 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
678 | 60 | logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); | ||
679 | 61 | TESTUNITREADY(sd, | ||
680 | 62 | EXPECT_STATUS_GOOD); | ||
681 | 63 | + | ||
682 | 64 | + /* restore transport callbacks */ | ||
683 | 65 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
684 | 66 | } | ||
685 | 67 | -- | ||
686 | 68 | 2.28.0 | ||
687 | 69 | |||
688 | diff --git a/debian/patches/lp-1894129-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch b/debian/patches/lp-1894129-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch | |||
689 | 0 | new file mode 100644 | 70 | new file mode 100644 |
690 | index 0000000..4a253a1 | |||
691 | --- /dev/null | |||
692 | +++ b/debian/patches/lp-1894129-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch | |||
693 | @@ -0,0 +1,166 @@ | |||
694 | 1 | From 153ca193fa61be8c2c26d8736119e7dc873d1242 Mon Sep 17 00:00:00 2001 | ||
695 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
696 | 3 | Date: Mon, 16 Sep 2019 14:46:28 +0200 | ||
697 | 4 | Subject: [PATCH] test-tool/iSCSIDataSnInvalid: override driver queue_pdu() | ||
698 | 5 | callback | ||
699 | 6 | |||
700 | 7 | In preparation for removing the test-tool iscsi_queue_pdu() dlsym | ||
701 | 8 | overload hack, convert this test to use the regular transport driver | ||
702 | 9 | callback for this purpose. | ||
703 | 10 | This commit also removes a number of unnecessary "WRITE10 is not | ||
704 | 11 | implemented" checks, which should all be caught by the first check. | ||
705 | 12 | |||
706 | 13 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
707 | 14 | |||
708 | 15 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/153ca193 | ||
709 | 16 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
710 | 17 | Last-Update: 2020-09-08 | ||
711 | 18 | |||
712 | 19 | --- | ||
713 | 20 | test-tool/test_iscsi_datasn_invalid.c | 56 ++++++++++----------------- | ||
714 | 21 | 1 file changed, 21 insertions(+), 35 deletions(-) | ||
715 | 22 | |||
716 | 23 | diff --git a/test-tool/test_iscsi_datasn_invalid.c b/test-tool/test_iscsi_datasn_invalid.c | ||
717 | 24 | index 14deb7a..c25631a 100644 | ||
718 | 25 | --- a/test-tool/test_iscsi_datasn_invalid.c | ||
719 | 26 | +++ b/test-tool/test_iscsi_datasn_invalid.c | ||
720 | 27 | @@ -25,13 +25,14 @@ | ||
721 | 28 | #include "iscsi-test-cu.h" | ||
722 | 29 | |||
723 | 30 | static int change_datasn; | ||
724 | 31 | +static struct iscsi_transport iscsi_drv_orig; | ||
725 | 32 | |||
726 | 33 | -static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu _U_) | ||
727 | 34 | +static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
728 | 35 | { | ||
729 | 36 | uint32_t datasn; | ||
730 | 37 | |||
731 | 38 | if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) { | ||
732 | 39 | - return 0; | ||
733 | 40 | + goto out; | ||
734 | 41 | } | ||
735 | 42 | switch (change_datasn) { | ||
736 | 43 | case 1: | ||
737 | 44 | @@ -52,11 +53,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu | ||
738 | 45 | scsi_set_uint32(&pdu->outdata.data[36], 1 - datasn); | ||
739 | 46 | break; | ||
740 | 47 | } | ||
741 | 48 | - return 0; | ||
742 | 49 | +out: | ||
743 | 50 | + return iscsi_drv_orig.queue_pdu(iscsi, pdu); | ||
744 | 51 | } | ||
745 | 52 | |||
746 | 53 | void test_iscsi_datasn_invalid(void) | ||
747 | 54 | -{ | ||
748 | 55 | +{ | ||
749 | 56 | int ret; | ||
750 | 57 | |||
751 | 58 | CHECK_FOR_DATALOSS; | ||
752 | 59 | @@ -77,7 +79,9 @@ void test_iscsi_datasn_invalid(void) | ||
753 | 60 | |||
754 | 61 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
755 | 62 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
756 | 63 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
757 | 64 | + /* override transport queue_pdu callback for PDU manipulation */ | ||
758 | 65 | + iscsi_drv_orig = *sd->iscsi_ctx->drv; | ||
759 | 66 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
760 | 67 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); | ||
761 | 68 | iscsi_set_timeout(sd->iscsi_ctx, 3); | ||
762 | 69 | |||
763 | 70 | @@ -89,81 +93,63 @@ void test_iscsi_datasn_invalid(void) | ||
764 | 71 | if (ret == -2) { | ||
765 | 72 | logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); | ||
766 | 73 | CU_PASS("WRITE10 is not implemented."); | ||
767 | 74 | - local_iscsi_queue_pdu = NULL; | ||
768 | 75 | - return; | ||
769 | 76 | - } | ||
770 | 77 | + goto out_ctx_restore; | ||
771 | 78 | + } | ||
772 | 79 | CU_ASSERT_NOT_EQUAL(ret, 0); | ||
773 | 80 | |||
774 | 81 | + /* avoid changing DataSN during reconnect */ | ||
775 | 82 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
776 | 83 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
777 | 84 | |||
778 | 85 | - | ||
779 | 86 | logging(LOG_VERBOSE, "Send Data-Out PDU with DataSN==27. Should fail"); | ||
780 | 87 | change_datasn = 2; | ||
781 | 88 | |||
782 | 89 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
783 | 90 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
784 | 91 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
785 | 92 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
786 | 93 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); | ||
787 | 94 | iscsi_set_timeout(sd->iscsi_ctx, 3); | ||
788 | 95 | |||
789 | 96 | ret = write10(sd, 100, block_size, | ||
790 | 97 | block_size, 0, 0, 0, 0, 0, scratch, | ||
791 | 98 | EXPECT_STATUS_GOOD); | ||
792 | 99 | - if (ret == -2) { | ||
793 | 100 | - logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); | ||
794 | 101 | - CU_PASS("WRITE10 is not implemented."); | ||
795 | 102 | - local_iscsi_queue_pdu = NULL; | ||
796 | 103 | - return; | ||
797 | 104 | - } | ||
798 | 105 | CU_ASSERT_NOT_EQUAL(ret, 0); | ||
799 | 106 | |||
800 | 107 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
801 | 108 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
802 | 109 | |||
803 | 110 | - | ||
804 | 111 | logging(LOG_VERBOSE, "Send Data-Out PDU with DataSN==-1. Should fail"); | ||
805 | 112 | change_datasn = 3; | ||
806 | 113 | |||
807 | 114 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
808 | 115 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
809 | 116 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
810 | 117 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
811 | 118 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); | ||
812 | 119 | iscsi_set_timeout(sd->iscsi_ctx, 3); | ||
813 | 120 | |||
814 | 121 | ret = write10(sd, 100, block_size, | ||
815 | 122 | block_size, 0, 0, 0, 0, 0, scratch, | ||
816 | 123 | EXPECT_STATUS_GOOD); | ||
817 | 124 | - if (ret == -2) { | ||
818 | 125 | - logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); | ||
819 | 126 | - CU_PASS("WRITE10 is not implemented."); | ||
820 | 127 | - local_iscsi_queue_pdu = NULL; | ||
821 | 128 | - return; | ||
822 | 129 | - } | ||
823 | 130 | CU_ASSERT_NOT_EQUAL(ret, 0); | ||
824 | 131 | |||
825 | 132 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
826 | 133 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
827 | 134 | |||
828 | 135 | - | ||
829 | 136 | - | ||
830 | 137 | logging(LOG_VERBOSE, "Send Data-Out PDU's in reverse order (DataSN == 1,0). Should fail"); | ||
831 | 138 | change_datasn = 4; | ||
832 | 139 | |||
833 | 140 | sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; | ||
834 | 141 | sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; | ||
835 | 142 | - local_iscsi_queue_pdu = my_iscsi_queue_pdu; | ||
836 | 143 | + sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; | ||
837 | 144 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); | ||
838 | 145 | iscsi_set_timeout(sd->iscsi_ctx, 3); | ||
839 | 146 | |||
840 | 147 | ret = write10(sd, 100, 2 * block_size, | ||
841 | 148 | block_size, 0, 0, 0, 0, 0, scratch, | ||
842 | 149 | EXPECT_STATUS_GOOD); | ||
843 | 150 | - if (ret == -2) { | ||
844 | 151 | - logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); | ||
845 | 152 | - CU_PASS("WRITE10 is not implemented."); | ||
846 | 153 | - local_iscsi_queue_pdu = NULL; | ||
847 | 154 | - return; | ||
848 | 155 | - } | ||
849 | 156 | CU_ASSERT_NOT_EQUAL(ret, 0); | ||
850 | 157 | - | ||
851 | 158 | - local_iscsi_queue_pdu = NULL; | ||
852 | 159 | +out_ctx_restore: | ||
853 | 160 | + /* restore transport callbacks and autoreconnect */ | ||
854 | 161 | + *(sd->iscsi_ctx->drv) = iscsi_drv_orig; | ||
855 | 162 | iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); | ||
856 | 163 | } | ||
857 | 164 | -- | ||
858 | 165 | 2.28.0 | ||
859 | 166 | |||
860 | diff --git a/debian/patches/lp-1894129-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch b/debian/patches/lp-1894129-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch | |||
861 | 0 | new file mode 100644 | 167 | new file mode 100644 |
862 | index 0000000..6cd1a9f | |||
863 | --- /dev/null | |||
864 | +++ b/debian/patches/lp-1894129-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch | |||
865 | @@ -0,0 +1,104 @@ | |||
866 | 1 | From dd17293bcc188dbefc420ee23b77bc9bb7c5e9a2 Mon Sep 17 00:00:00 2001 | ||
867 | 2 | From: David Disseldorp <ddiss@suse.de> | ||
868 | 3 | Date: Mon, 16 Sep 2019 16:02:36 +0200 | ||
869 | 4 | Subject: [PATCH] test-tool: remove unused iscsi_queue_pdu() symbol overload | ||
870 | 5 | |||
871 | 6 | All users have now been changed to overload via the iscsi_ctx transport | ||
872 | 7 | callback, so the dlsym based overloading can now be dropped. | ||
873 | 8 | |||
874 | 9 | Signed-off-by: David Disseldorp <ddiss@suse.de> | ||
875 | 10 | |||
876 | 11 | Origin: upstream, https://github.com/sahlberg/libiscsi/commit/dd17293b | ||
877 | 12 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1894129 | ||
878 | 13 | Last-Update: 2020-09-08 | ||
879 | 14 | |||
880 | 15 | --- | ||
881 | 16 | test-tool/iscsi-support.c | 11 ----------- | ||
882 | 17 | test-tool/iscsi-support.h | 1 - | ||
883 | 18 | test-tool/iscsi-test-cu.c | 15 --------------- | ||
884 | 19 | 3 files changed, 27 deletions(-) | ||
885 | 20 | |||
886 | 21 | diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c | ||
887 | 22 | index 4b49478..169d2b0 100644 | ||
888 | 23 | --- a/test-tool/iscsi-support.c | ||
889 | 24 | +++ b/test-tool/iscsi-support.c | ||
890 | 25 | @@ -119,8 +119,6 @@ int readonly; | ||
891 | 26 | int sbc3_support; | ||
892 | 27 | int maximum_transfer_length; | ||
893 | 28 | |||
894 | 29 | -int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); | ||
895 | 30 | - | ||
896 | 31 | static const unsigned char zeroBlock[4096]; | ||
897 | 32 | |||
898 | 33 | /** | ||
899 | 34 | @@ -569,15 +567,6 @@ wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state * | ||
900 | 35 | } | ||
901 | 36 | } | ||
902 | 37 | |||
903 | 38 | -int | ||
904 | 39 | -iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) | ||
905 | 40 | -{ | ||
906 | 41 | - if (local_iscsi_queue_pdu != NULL) { | ||
907 | 42 | - local_iscsi_queue_pdu(iscsi, pdu); | ||
908 | 43 | - } | ||
909 | 44 | - return real_iscsi_queue_pdu(iscsi, pdu); | ||
910 | 45 | -} | ||
911 | 46 | - | ||
912 | 47 | int | ||
913 | 48 | orwrite(struct scsi_device *sdev, uint64_t lba, | ||
914 | 49 | uint32_t datalen, int blocksize, int wrprotect, | ||
915 | 50 | diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h | ||
916 | 51 | index aee00ca..2b20a1f 100644 | ||
917 | 52 | --- a/test-tool/iscsi-support.h | ||
918 | 53 | +++ b/test-tool/iscsi-support.h | ||
919 | 54 | @@ -782,7 +782,6 @@ struct iscsi_async_state { | ||
920 | 55 | void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state); | ||
921 | 56 | |||
922 | 57 | struct iscsi_pdu; | ||
923 | 58 | -int (*local_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); | ||
924 | 59 | |||
925 | 60 | struct scsi_command_descriptor *get_command_descriptor(int opcode, int sa); | ||
926 | 61 | |||
927 | 62 | diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c | ||
928 | 63 | index eafda39..26e1b05 100644 | ||
929 | 64 | --- a/test-tool/iscsi-test-cu.c | ||
930 | 65 | +++ b/test-tool/iscsi-test-cu.c | ||
931 | 66 | @@ -59,12 +59,6 @@ int loglevel = LOG_NORMAL; | ||
932 | 67 | struct scsi_device *sd = NULL; /* mp_sds[0] alias */ | ||
933 | 68 | static unsigned int maxsectors; | ||
934 | 69 | |||
935 | 70 | -/* | ||
936 | 71 | - * this allows us to redefine how PDU are queued, at times, for | ||
937 | 72 | - * testing purposes | ||
938 | 73 | - */ | ||
939 | 74 | -int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); | ||
940 | 75 | - | ||
941 | 76 | /***************************************************************** | ||
942 | 77 | * | ||
943 | 78 | * list of tests and test suites | ||
944 | 79 | @@ -805,7 +799,6 @@ test_setup(void) | ||
945 | 80 | { | ||
946 | 81 | task = NULL; | ||
947 | 82 | read_write_buf = NULL; | ||
948 | 83 | - local_iscsi_queue_pdu = NULL; | ||
949 | 84 | } | ||
950 | 85 | |||
951 | 86 | void | ||
952 | 87 | @@ -1214,14 +1207,6 @@ main(int argc, char *argv[]) | ||
953 | 88 | mp_num_sds++; | ||
954 | 89 | } | ||
955 | 90 | |||
956 | 91 | - /* So that we can override iscsi_queue_pdu in tests | ||
957 | 92 | - * and replace or mutate the blob that we are about to write to the | ||
958 | 93 | - * wire. | ||
959 | 94 | - * This allows such tests to do their mutates and then call out | ||
960 | 95 | - * to the real queueing function once they have modified the data. | ||
961 | 96 | - */ | ||
962 | 97 | - real_iscsi_queue_pdu = dlsym(RTLD_NEXT, "iscsi_queue_pdu"); | ||
963 | 98 | - | ||
964 | 99 | if ((mp_num_sds == 0) || (mp_sds[0]->iscsi_url == NULL | ||
965 | 100 | && mp_sds[0]->sgio_dev == NULL)) { | ||
966 | 101 | #ifdef HAVE_SG_IO | ||
967 | 102 | -- | ||
968 | 103 | 2.28.0 | ||
969 | 104 | |||
970 | diff --git a/debian/patches/series b/debian/patches/series | |||
971 | index de65f63..36e1d44 100644 | |||
972 | --- a/debian/patches/series | |||
973 | +++ b/debian/patches/series | |||
974 | @@ -3,3 +3,15 @@ soversion.diff | |||
975 | 3 | libpthread.diff | 3 | libpthread.diff |
976 | 4 | attribute_packed.patch | 4 | attribute_packed.patch |
977 | 5 | spelling.patch | 5 | spelling.patch |
978 | 6 | lp-1894129-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch | ||
979 | 7 | lp-1894129-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch | ||
980 | 8 | lp-1894129-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch | ||
981 | 9 | lp-1894129-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch | ||
982 | 10 | lp-1894129-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch | ||
983 | 11 | lp-1894129-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch | ||
984 | 12 | lp-1894129-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch | ||
985 | 13 | lp-1894129-test-tool-CryptoEraseReserved-override-driver-queue_.patch | ||
986 | 14 | lp-1894129-test-tool-OverwriteReserved-override-driver-queue_pd.patch | ||
987 | 15 | lp-1894129-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch | ||
988 | 16 | lp-1894129-test-tool-BlockEraseReserved-override-driver-queue_p.patch | ||
989 | 17 | lp-1894129-test-tool-Use-extern-int-in-headers.patch |
PPA: https:/ /launchpad. net/~ci- train-ppa- service/ +archive/ ubuntu/ 4256/+packages