Merge lp:~smb/ubuntu/oneiric/iscsitarget/proposed into lp:ubuntu/oneiric/iscsitarget

Proposed by Stefan Bader
Status: Merged
Merged at revision: 20
Proposed branch: lp:~smb/ubuntu/oneiric/iscsitarget/proposed
Merge into: lp:ubuntu/oneiric/iscsitarget
Diff against target: 16471 lines (+14947/-284)
90 files modified
.pc/.version (+1/-0)
.pc/applied-patches (+2/-0)
.pc/debian-changes-1.4.20.2-5/ChangeLog (+652/-0)
.pc/debian-changes-1.4.20.2-5/Makefile (+352/-0)
.pc/debian-changes-1.4.20.2-5/RELEASE_NOTES (+176/-0)
.pc/debian-changes-1.4.20.2-5/dkms.conf (+61/-0)
.pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5 (+336/-0)
.pc/debian-changes-1.4.20.2-5/etc/ietd.conf (+110/-0)
.pc/debian-changes-1.4.20.2-5/etc/initd/initd (+39/-0)
.pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian (+75/-0)
.pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo (+39/-0)
.pc/debian-changes-1.4.20.2-5/include/iet_u.h (+151/-0)
.pc/debian-changes-1.4.20.2-5/iscsitarget.spec (+507/-0)
.pc/debian-changes-1.4.20.2-5/kernel/block-io.c (+327/-0)
.pc/debian-changes-1.4.20.2-5/kernel/config.c (+362/-0)
.pc/debian-changes-1.4.20.2-5/kernel/conn.c (+262/-0)
.pc/debian-changes-1.4.20.2-5/kernel/iotype.c (+110/-0)
.pc/debian-changes-1.4.20.2-5/kernel/iscsi.c (+1967/-0)
.pc/debian-changes-1.4.20.2-5/kernel/iscsi.h (+524/-0)
.pc/debian-changes-1.4.20.2-5/kernel/nthread.c (+790/-0)
.pc/debian-changes-1.4.20.2-5/kernel/param.c (+205/-0)
.pc/debian-changes-1.4.20.2-5/kernel/target.c (+374/-0)
.pc/debian-changes-1.4.20.2-5/kernel/target_disk.c (+589/-0)
.pc/debian-changes-1.4.20.2-5/kernel/tio.c (+121/-0)
.pc/debian-changes-1.4.20.2-5/kernel/volume.c (+422/-0)
.pc/debian-changes-1.4.20.2-5/kernel/wthread.c (+245/-0)
.pc/debian-changes-1.4.20.2-5/patches/compat-2.6.14-2.6.18.patch (+252/-0)
.pc/debian-changes-1.4.20.2-5/patches/compat-2.6.19-2.6.21.patch (+56/-0)
.pc/debian-changes-1.4.20.2-5/patches/compat-2.6.22.patch (+95/-0)
.pc/debian-changes-1.4.20.2-5/patches/compat-2.6.24.patch (+12/-0)
.pc/debian-changes-1.4.20.2-5/patches/compat-2.6.30.patch (+11/-0)
.pc/debian-changes-1.4.20.2-5/usr/Makefile (+16/-0)
.pc/debian-changes-1.4.20.2-5/usr/config.h (+51/-0)
.pc/debian-changes-1.4.20.2-5/usr/conn.c (+101/-0)
.pc/debian-changes-1.4.20.2-5/usr/event.c (+132/-0)
.pc/debian-changes-1.4.20.2-5/usr/ietd.c (+569/-0)
.pc/debian-changes-1.4.20.2-5/usr/iscsid.c (+914/-0)
.pc/debian-changes-1.4.20.2-5/usr/param.c (+316/-0)
.pc/debian-changes-1.4.20.2-5/usr/plain.c (+858/-0)
.pc/debian-changes-1.4.20.2-5/usr/session.c (+165/-0)
.pc/debian-changes-1.4.20.2-5/usr/target.c (+322/-0)
.pc/ubuntu-changes-1.4.20.2-5/dkms.conf (+67/-0)
ChangeLog (+71/-9)
Makefile (+19/-4)
RELEASE_NOTES (+28/-0)
debian/changelog (+48/-0)
debian/control (+2/-0)
debian/dkms.conf.in (+0/-45)
debian/patches/debian-changes-1.4.20.2-5 (+1630/-0)
debian/patches/series (+2/-0)
debian/rules (+10/-0)
dkms.conf (+48/-39)
doc/manpages/ietd.conf.5 (+3/-3)
etc/ietd.conf (+6/-4)
etc/initd/initd (+1/-1)
etc/initd/initd.debian (+1/-1)
etc/initd/initd.gentoo (+2/-2)
include/iet_u.h (+1/-1)
iscsitarget.spec (+5/-2)
kernel/block-io.c (+8/-6)
kernel/config.c (+5/-5)
kernel/conn.c (+1/-3)
kernel/iotype.c (+1/-1)
kernel/iscsi.c (+29/-15)
kernel/iscsi.h (+1/-1)
kernel/nthread.c (+3/-1)
kernel/param.c (+2/-0)
kernel/target.c (+22/-20)
kernel/target_disk.c (+34/-18)
kernel/tio.c (+4/-0)
kernel/volume.c (+7/-5)
kernel/wthread.c (+10/-9)
patches/compat-2.6.14-2.6.18.patch (+13/-13)
patches/compat-2.6.19-2.6.21.patch (+1/-1)
patches/compat-2.6.22.patch (+1/-1)
patches/compat-2.6.24.patch (+18/-0)
patches/compat-2.6.30.patch (+13/-2)
patches/compat-2.6.33-2.6.35.patch (+13/-0)
patches/compat-2.6.36-2.6.37.patch (+34/-0)
patches/compat-2.6.38.patch (+44/-0)
usr/Makefile (+3/-3)
usr/config.h (+1/-1)
usr/conn.c (+1/-1)
usr/event.c (+3/-4)
usr/ietd.c (+5/-6)
usr/iscsid.c (+30/-40)
usr/param.c (+13/-11)
usr/plain.c (+9/-6)
usr/session.c (+2/-0)
usr/target.c (+3/-0)
To merge this branch: bzr merge lp:~smb/ubuntu/oneiric/iscsitarget/proposed
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+66307@code.launchpad.net

Description of the change

This brings the package to the version in Debian experimental which fixes compile failures with kernels after 2.6.38 for the produced dkms package. There is one additional change which modifies the dkms.conf file (missing upstream as well) to make it compile on kernels before 2.6.39.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory '.pc'
=== added file '.pc/.version'
--- .pc/.version 1970-01-01 00:00:00 +0000
+++ .pc/.version 2011-06-29 14:00:59 +0000
@@ -0,0 +1,1 @@
12
02
=== added file '.pc/applied-patches'
--- .pc/applied-patches 1970-01-01 00:00:00 +0000
+++ .pc/applied-patches 2011-06-29 14:00:59 +0000
@@ -0,0 +1,2 @@
1debian-changes-1.4.20.2-5
2ubuntu-changes-1.4.20.2-5
03
=== added directory '.pc/debian-changes-1.4.20.2-5'
=== added file '.pc/debian-changes-1.4.20.2-5/ChangeLog'
--- .pc/debian-changes-1.4.20.2-5/ChangeLog 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/ChangeLog 2011-06-29 14:00:59 +0000
@@ -0,0 +1,652 @@
1Summary of changes from v1.4.20.1 to v1.4.20.2
2=================================
3Arne Redlich
4 o uninitialized data fixes pointed out by valgrind
5 o fix invalid read in iSNS code pointed out by valgrind
6
7Ross Walker
8 o check buffer boundaries in iSNS code (CVE-2010-2221)
9 o fix memleak in iSNS ACL code
10 o clean up iSCSI login response error handling
11 o rework ietd startup to avoid concurrent ietds
12 o fix soft lockup during UA allocation
13 o change DISTDIR to DESTDIR
14 o avoid deletion of targets with active sessions
15 o byte swap fix in MD5 / SHA1 code (thanks to Harshal Shete for testing on PPC)
16
17Summary of changes from v1.4.20 to v1.4.20.1
18=================================
19Arne Redlich
20 o adapt backward compat mechanism in Makefile to kernels >= 2.6.33
21
22Ross Walker
23 o restore SCSI SN behaviour of IET < 1.4.20 (VMWare compatibility)
24
25Summary of changes from v1.4.19 to v1.4.20
26=================================
27Minh Tran
28 o fix TTT for final PDU in ietd
29
30Qinghua(Kevin) Ye
31 o release reservations during session delete
32
33Ross Walker
34 o multiple updates for abort task compliance
35 o replace sync_page_range with filemap_write_and_wait_range in fileio
36 o replace do_sync_read/write with vfs_read/write in fileio
37 o multiple updates for target_del_all, atomic deletion of targets,
38 sessions and connections
39 o install moves existing kernel module, uninstall moves it back
40 o cleaned up RPM and DKMS package building
41 o cleaned up usr-kernel ioctl calls, added version checking, semaphore
42 to prevent ioctls during kernel cleanup (target_del_all)
43 o cleaned up session and connection reinstatement
44 o setup IO contexts in wthread, fixes CFQ performance problem
45 o enabled multiple connections per session
46 o moved common parameters from iotypes to volume
47 o UA handling on aborted/terminated connections
48 o removed OpenSSL dependency by borrowing kernel md5/sha1 code
49 o code cleanups
50
51Arne Redlich
52 o multiple kernel compatibility updates
53 o code cleanups
54
55Lars Ellenberg
56 o support for logical sector sizes
57 o case insensitive volume options
58 o code cleanups
59
60Luca Berra
61 o fix warnings when compiling via gcc strict checks
62
63Kun Huang
64 o temporary target redirections via ietadm for existing targets
65
66Jagadish Kumar
67 o multiple code cleanups around network and worker thread handling
68
69Summary of changes from v1.4.18 to v1.4.19
70=================================
71Andreas Florath
72 o re-enable MaxSessions parameter
73 o code cleanups
74
75Arne Redlich
76 o NOP-In support
77
78Harshal Shete
79 o add notes about cross compilation to README
80
81SZÉKELYI Szabolcs
82 o fix ietadm manpage
83
84Ross S. W. Walker
85 o fix initiators/targets.allow bugs
86 o fix compiler warnings
87 o fix return value of session_add()
88 o update RPM specfile improving RedHat and SuSE compatibility
89 (based on a patch from Matthew Wild)
90 o update RELEASE NOTES
91
92Kevin Ye
93 o fix session cleanup in case of -EPIPE during login
94
95
96Summary of changes from v0.4.17 to v1.4.18
97=================================
98Lars Ellenberg
99 o improve IETs procfs support to allow a larger number of targets
100 o compatibility fix for 2.6.28 (independently also provided by Francois
101 Micaux)
102 o ignore SIGPIPE in ietd
103 o allow cleanup of stale targets in the kernel module
104
105Andreas Florath
106 o support for a global worker threadpool instead of per target pools
107 (configurable via the worker_thread_pool_size module parameter)
108
109Arne Redlich
110 o compatibility fixes for 2.6.30, 2.6.29
111 o in cooperation with Xie Gang: Unit Attention support (thanks to Stefan
112 Rubner for spotting a bug)
113 o in cooperation with Shreyansh Jain: support for splitting text messages into
114 several PDUs, allowing more targets to be reported during discovery
115 (thanks to Cheng Rengquan for bugfixes)
116 o clean up all connections, sessions and targets in the kernel module if the
117 daemon is gone
118 o rework sense data handling, plugging memleaks
119 o fix valgrind warnings of uses of uninitialized variables
120 o support for Reject PDUs (thanks to FUJITA Tomonori for a bugfix)
121 o fix SERVICE ACTION IN: IET only supports READ CAPACITY 16, return sense data
122 for all others
123 o allow READ CAPACITY even if a LU is RESERVEd
124 o iSNS: report the actual target port instead of the default iSCSI port
125 o fix list corruption if target thread creation fails
126 o fix stopping of threads that have never been awakened before
127 o fix CHAP account handling bugs
128 o fix netlink socket cleanup
129 o code cleanups
130
131Cheng Renquan
132 o remove superfluous linefeed from debug messages
133 o enable runtime switching of debug levels for the kernel module and
134 provide description for the module's debug flags parameter
135
136sdrb
137 o return proper status class in case of login failures
138
139Ross S. W. Walker
140 o support more than one portal per target during discovery, and allow
141 configuration of the presented portals using targets.allow - previously only
142 the incoming interface was reported (thanks to David Shirley for
143 reporting a bug)
144 o deprecate initiators.allow
145 o regex based filtering in initiators.allow and targets.allow
146 o move config files to /etc/iet
147 o add version and author info and description to kernel module
148 o fix debug log levels
149 o fix ietd.conf permissions
150 o move kernel module to /lib/modules/<kver>/extra where it belongs
151 o improve init scripts, using common names and functions across distributions
152 o improve usage comments in ietd.conf
153 o specfile to build RPMs, including weak module support
154 o DKMS support
155
156Ming Zhang
157 o Use the LU's sector size in the format mode page instead of defaulting to 512
158
159Summary of changes from v0.4.16 to v0.4.17
160=================================
161
162Charley Cheng
163 o handle the \0-termination of strings properly when building iSNS TLVs
164
165Denis ChengRq
166 o fix stopping of wthreads that have never been awakened
167
168Shreyansh Jain
169 o fix debugging code that hexdumps PDU content to the syslog
170
171Jagadish Kumar
172 o avoid busy looping if a connection's socket is out of wmem
173
174Arne Redlich
175 o add support for "ietadm --op show --user"
176 o SCSI fixes: MODE SENSE handling, INQUIRY CmdDt, HiSup, WCE and RCD handling
177 o fix handling of NOP-Out w/ ping data
178 o fix compilation against glibc >= 2.8
179 o fix potential NULL-pointer derefences and resource leaks in the LUN param
180 parsing code
181 o documentation updates
182
183Ross S. W. Walker
184 o 2.6.26 and SLES compile fix
185 o SLES 10 SP2 compat patch
186
187Ming Zhang
188 o make needlessly global function static
189
190
191Summary of changes from v0.4.15 to v0.4.16
192=================================
193
194Arne Redlich
195 o fix overzealous assert() in digest_data()
196 o add checking on return value of ISCSI_PARAM_GET
197 o 2.6.22, 2.6.23 and 2.6.24 compile fixes
198 o add conn->rwsize check
199 o avoid potential NULL-ptr dereferences in rx and tx buffer
200 o fix the shell syntax in init scripts
201
202Dave Jiang
203 o fix digest endieness on LE archs
204
205FUJITA Tomonori
206 o fix SPARC alignement issues (based on a patch from joel.bertrand@systella.fr)
207
208Ross S. W. Walker
209 o fix DISTDIR in Makefile for /etc install
210 o add support to nullio for volumes > 2TB
211 o remove init.d memory size adjustment
212 o add error code reporting to blockio_open_path
213 o blockio gen_scsiid bug fix
214 o add verbosity to kernel output and task management
215
216
217Summary of changes from v0.4.14 to v0.4.15
218=================================
219
220Juhani Rautiainen
221 o Add RELEASE/RESERVE support
222
223Ross S. W. Walker
224 o Improve the build system to support several kernel versions
225 o Add block-io support
226
227
228Summary of changes from v0.4.13 to v0.4.14
229=================================
230
231Arne Redlich
232 o Kill unused "state" in struct iscsi_cmnd.
233 o Fixed fileio_sync() to propagate error to the caller (and initiator).
234 o Don't attempt to show target/session params if communication with ietd
235 fails.
236 o Fixes to ietadm parameters handling.
237
238FUJITA Tomonori
239 o rewritten iSNS code, many iSNS fixes.
240 o added iSNS SCN support.
241 o IPv6 fixes to userspace.
242
243Ming Zhang
244 o Fix the READ_* commands error handling bug.
245 o fix the mode sense response.
246 o wrong #endif sequence in misc.h
247
248Richard Bollinger
249 o add a patch to ietd.c that allows defunct sessions to go away.
250 o add write-back cache and read-only support.
251
252Frederic Temporelli
253 o Fix for the combination of 32-bit userland and 64-bit kernel on mips.
254
255Henry Liu
256 o corrected many task management functions, prevent crashing on
257 LUN RESET, TARGET WARM RESET.
258
259K Chapman
260 o Fixed a typo in check_segment_length().
261
262Emmanuel Florac
263 o Add ietadm manpage.
264
265
266Summary of changes from v0.4.12 to v0.4.13
267=================================
268Arne Redlich
269 o patch to avoid digest calculation for PDUs whose data has been skipped
270 already for various reasons.
271 o Correct a bug managing non-default MaxRxDSL.
272 o added to ietadm ability to show target parameters.
273 o add on the workaround to AIX initiator MaxCmdSN bug.
274
275FUJITA Tomonori
276 o added to ietadm ability to show the iSCSI parameters for an established
277 session.
278
279Ming Zhang
280 o Fixed this bug : ietd should manage the iscsi name in a case insensitive
281 way to conform to the RFC.
282 o workaround to AIX initiator MaxCmdSN bug.
283 o Fixed socket() return value judgment.
284
285Bastiaan Bakker
286 o add 'condrestart' command to the RedHat initscript.
287
288Robert Whitehead
289 o correct the bug that prevents iet to start if there isn't
290 an /etc/ietd.conf file.
291
292
293Summary of changes from v0.4.11 to v0.4.12
294=================================
295
296Arne Redlich
297 o Fix MaxRecvDataSegmentLength handling.
298 o Fix login parameter handling.
299 o Update man pages.
300
301Bastiaan Bakker
302 o Add features to specify the listen address and port.
303 o Fix setuid and setgid bugs in ietd daemon.
304
305FUJITA Tomonori
306 o Add IPv6 support.
307
308Junjiro Okajima
309 o Fix a bug about getting parameters from kernel space.
310
311Krzysztof Blaszkowski
312 o Fix for requests with unaligned to 4 length.
313
314
315Summary of changes from v0.4.10 to v0.4.11
316=================================
317
318FUJITA Tomonori
319 o Fix Task Management Function bugs.
320
321Ming Zhang
322 o Update man pages.
323
324
325Summary of changes from v0.4.9 to v0.4.10
326=================================
327
328Arne Redlich
329 o Fix 0x83 inquiry output.
330 o Fix iSCSI parameter handling bugs.
331
332FUJITA Tomonori
333 o Add the access control based on initiator address
334 and target name patterns.
335
336Junjiro Okajima
337 o Fix parameter checking bugs.
338
339Ming Zhang
340 o Add the nullio mode (only useful for performance evaluation).
341
342
343Summary of changes from v0.4.8 to v0.4.9
344=================================
345
346FUJITA Tomonori
347 o Fix parameter negotiation handling bugs.
348
349Wang Zhenyu
350 o Fix digest negotiation handling bugs.
351
352
353Summary of changes from v0.4.7 to v0.4.8
354=================================
355
356FUJITA Tomonori
357 o Fix unsolicited data handling bugs.
358 o Rewrite parameter handling code.
359 o Rewrite ietadm tool.
360 o Improve dynamic configuration support.
361 o Cleanups on the kernel-user interface.
362 o Improve wrong PDU handling.
363 o Implement a framework to handle multiple configuration methods.
364 o Implement basic access control support.
365
366
367Summary of changes from v0.4.6 to v0.4.7
368=================================
369
370Florian Zierer
371 o Add the startup script for Gentoo.
372
373FUJITA Tomonori
374 o Rewrite parameter handling code.
375 o Fix task management code bug.
376 o Fix 0x83 inquiry output (Thanks to Christophe Varoqui).
377
378Ming Zhang
379 o Acquire T10 ID.
380 o Fix parameter handling bugs.
381 o Some user-space cleanups.
382
383Philipp Hug
384 o Fix ietd.8 man typo.
385
386
387Summary of changes from v0.4.5 to v0.4.6
388=================================
389
390FUJITA Tomonori
391 o Replace the makeshift event notification code with netlink.
392 o Add task management code except for ACA and reassign stuff.
393 o Fix r2t lun bug (Thanks to Ming Zhang).
394
395
396Summary of changes from v0.4.4 to v0.4.5
397=================================
398
399FUJITA Tomonori
400 o Rewrite the iSCSI command handling code.
401 o Rewrite the I/O data handling code.
402 o Fix worker thread.
403 o Several cleanups.
404
405
406Summary of changes from v0.4.3 to v0.4.4
407=================================
408
409Krzysztof Blaszkowski
410 o Fix an out-of-memory bug.
411
412
413Summary of changes from v0.4.2 to v0.4.3
414=================================
415
416Arne Redlich
417 o Fix header digest bug.
418 o Fix unexpected closed connection bug.
419 o Fix iSCSI parameter bug.
420
421FUJITA Tomonori
422 o Fix network thread.
423
424
425Summary of changes from v0.4.1 to v0.4.2
426=================================
427
428FUJITA Tomonori
429 o Fix network thread.
430 o Fix MaxOutstandingR2T handling.
431
432Ming Zhang
433 o Add large volume support (over 2TB).
434
435
436Summary of changes from v0.4.0 to v0.4.1
437=================================
438
439Arne Redlich
440 o Add mutual CHAP support. Note that you need to replace "User"
441 with "IncomingUser" in ietd.conf.
442
443FUJITA Tomonori
444 o Fix InitialR2T=No support.
445 o Fix INQUIRY command handling.
446 o Fix network and worker thread.
447 o Start to split SCSI stuff.
448 o Rewrite the R2T handling code.
449 o Several cleanups.
450
451
452Summary of changes from v0.3.8 to v0.4.0
453=================================
454
455Arne Redlich
456 o iSNS bug fix.
457
458FUJITA Tomonori
459 o Move to 2.6 kernels.
460 o Rewrite the kernel thread performing network I/O.
461 o Add header and data digests (Thanks to Arne Redlich).
462
463Ming Zhang
464 o Add mode sense page 0x3 and 0x4 support (Thanks to K Chapman).
465 o iSNS bug fix.
466
467
468Summary of changes from v0.3.7 to v0.3.8
469=================================
470
471Arne Redlich
472 o Fix ietadm global option bug.
473
474FUJITA Tomonori
475 o Fix TCP option bugs (Thanks to Chuck Berg).
476 o Fix REPORT LUN (handling lots of LUs).
477
478
479Summary of changes from v0.3.6 to v0.3.7
480=================================
481
482Arne Redlich
483 o Fix target_alloc_pages().
484
485FUJITA Tomonori
486 o Fix REPORT LUN bug.
487
488
489Summary of changes from v0.3.5 to v0.3.6
490=================================
491
492Arne Redlich
493 o Fix bugs about rejecting PDUs.
494
495FUJITA Tomonori
496 o Cleanups on target_cmnd structure.
497 o Kill highmem stuff.
498 o Fix REPORT LUN (handling lots of LUs).
499
500
501Summary of changes from v0.3.4 to v0.3.5
502=================================
503
504Arne Redlich
505 o Fix ietd security hole.
506 o Fix REPORT LUN bug.
507 o FIX NOOP_OUT padding bug.
508
509FUJITA Tomonori
510 o Rewrite event notification code.
511
512Libor Vanek
513 o Add max_sessions option.
514 o Fix command parsing bug.
515
516Ming Zhang
517 o Cleanups for 64-bit architectures.
518
519
520Summary of changes from v0.3.3 to v0.3.4
521=================================
522
523FUJITA Tomonori
524 o Improve dynamic configuration support (adding targets and users).
525
526
527Summary of changes from v0.3.2 to v0.3.3
528=================================
529
530FUJITA Tomonori
531 o Fix Makefile for the startup script.
532
533
534Summary of changes from v0.3.1 to v0.3.2
535=================================
536
537Ali Lehmann
538 o Add a new startup script for Debian.
539
540FUJITA Tomonori
541 o Fix the istd's handling of connections in out-of-memory situations.
542 o Fix bugs in regular file support.
543 o Fix `ietadm --mode del all`.
544
545Libor Vanek
546 o Add a new startup script for RedHat.
547
548Ming Zhang
549 o Add uid/gid option to ietd daemon.
550 o Fix a access freed-memory bug in kernel/daemon.c.
551
552
553Summary of changes from v0.3.0 to v0.3.1
554=================================
555
556FUJITA Tomonori
557 o Fix memory leaks in ietd daemon (Thanks to Ming).
558 o Fix bugs about REPORT_LUNS commands (Thanks to Ming).
559 o Fix a bug about Target Task Tag.
560 o Add regular file support to fileio mode.
561
562
563Summary of changes from v0.2.6 to v0.3.0
564=================================
565
566Ali Lehmann
567 o Update ietd.8 man page.
568
569FUJITA Tomonori
570 o Fix shutdown code.
571 o Fix istd kernel thread bugs.
572 o Replace procfs interface with ioctl.
573 o Add dynamic configuration support.
574 o Update README and the boot script.
575
576Ming Zhang
577 o Add config option to ietd daemon.
578
579
580Summary of changes from v0.2.5 to v0.2.6
581=================================
582
583Ali Lehmann
584 o Add ietd.8 and ietd.conf.5 man pages.
585
586FUJITA Tomonori
587 o Update README, Makefile, and the boot script.
588
589
590Summary of changes from v0.2.4 to v0.2.5
591=================================
592
593FUJITA Tomonori
594 o Update README.
595
596
597Summary of changes from v0.2.3 to v0.2.4
598=================================
599
600Ming Zhang
601 o Add a preliminary iSNS support.
602 o Fix merge mistakes that I made at the previous release.
603
604
605Summary of changes from v0.2.2 to v0.2.3
606=================================
607
608Ming Zhang
609 o Improve INQUIRY, REQUEST_SENSE, and MODE_SENSE command supports
610 o Add fake RESERVE* and RELEASE* command supports
611
612
613Summary of changes from v0.2.1 to v0.2.2
614=================================
615
616FUJITA Tomonori
617 o Improve the write performance of the file IO mode
618
619Ming Zhang
620 o Fix unupdated pg_cnt when allocating a new tcmnd
621 o Several cleanups
622
623
624Summary of changes from v0.2.0 to v0.2.1
625=================================
626
627FUJITA Tomonori
628 o Fix a bug that makes the target use CPU unnecessarily
629 o Add a feature that enable you to pass options to an IO mode
630
631
632Summary of changes from v0.1.0 to v0.2.0
633=================================
634
635FUJITA Tomonori
636 o Rewrite read and write kernel threads which perform network IO
637 o Fix race issues in the proc interface
638 o Fix shutdown code
639
640Ming Zhang
641 o Fix memory leaks in file and block IO modes
642
643
644Summary of changes from the ardis v20040211 to v0.1.0
645=================================
646
647FUJITA Tomonori
648 o Remove a kernel patch. Multiple threads execute I/O operations
649 o Replace IO functions with the kernel starndard functions
650 o Add multiple IO modes feature
651 o Fix several race issues
652 o Fix several out-of-memory situation bugs
0653
=== added file '.pc/debian-changes-1.4.20.2-5/Makefile'
--- .pc/debian-changes-1.4.20.2-5/Makefile 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/Makefile 2011-06-29 14:00:59 +0000
@@ -0,0 +1,352 @@
1#
2# Makefile for the Linux kernel device drivers.
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (not a .c file).
7#
8# Note 2! The CFLAGS definitions are now in the main makefile.
9
10#export KSRC := /usr/src/linux
11
12SUBDIRS := $(shell pwd)
13
14ifeq ($(KSRC),)
15 KSRC ?= /lib/modules/$(shell uname -r)/build
16endif
17
18
19ifneq ($(wildcard $(KSRC)/include/generated/utsrelease.h),)
20 VERSION_FILE := $(KSRC)/include/generated/utsrelease.h
21else
22 ifneq ($(wildcard $(KSRC)/include/linux/utsrelease.h),)
23 VERSION_FILE := $(KSRC)/include/linux/utsrelease.h
24 else
25 VERSION_FILE := $(KSRC)/include/linux/version.h
26 endif
27endif
28
29KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \
30 grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
31
32KMOD := /lib/modules/$(KVER)/extra
33
34KMAJ := $(shell echo $(KVER) | \
35 sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
36KMIN := $(shell echo $(KVER) | \
37 sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
38KREV := $(shell echo $(KVER) | \
39 sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')
40
41kver_eq = $(shell [ $(KMAJ)$(KMIN)$(KREV) -eq $(1)$(2)$(3) ] && \
42 echo 1 || echo 0)
43kver_lt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -lt $(1)$(2)$(3) ] && \
44 echo 1 || echo 0)
45kver_le = $(shell [ $(KMAJ)$(KMIN)$(KREV) -le $(1)$(2)$(3) ] && \
46 echo 1 || echo 0)
47kver_gt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -gt $(1)$(2)$(3) ] && \
48 echo 1 || echo 0)
49kver_ge = $(shell [ $(KMAJ)$(KMIN)$(KREV) -ge $(1)$(2)$(3) ] && \
50 echo 1 || echo 0)
51kver_lk = $(shell [ `echo $(KVER) | egrep $(1)` ] && echo 1 || echo 0)
52
53#
54# Please when adding patch sets start with the latest to the earliest
55# the idea behind this is that by properly patching the latest code
56# base first the earlier patch sets will not need to be modified.
57#
58
59# Compatibility patch for kernels <= 2.6.32
60ifeq ($(call kver_le,2,6,32),1)
61 PATCHES := $(PATCHES) compat-2.6.32.patch
62endif
63
64# Compatibility patch for kernels <= 2.6.31
65ifeq ($(call kver_le,2,6,31),1)
66 PATCHES := $(PATCHES) compat-2.6.31.patch
67endif
68
69# Compatibility patch for kernels <= 2.6.30
70ifeq ($(call kver_le,2,6,30),1)
71 PATCHES := $(PATCHES) compat-2.6.30.patch
72endif
73
74# Compatibility patch for kernels <= 2.6.29
75ifeq ($(call kver_le,2,6,29),1)
76 PATCHES := $(PATCHES) compat-2.6.29.patch
77endif
78
79# Compatibility patch for kernels <= 2.6.28
80ifeq ($(call kver_le,2,6,28),1)
81 PATCHES := $(PATCHES) compat-2.6.28.patch
82endif
83
84# Compatibility patch for kernels >= 2.6.25 and <= 2.6.27
85ifeq ($(call kver_le,2,6,27),1)
86 PATCHES := $(PATCHES) compat-2.6.25-2.6.27.patch
87endif
88
89# Compatibility patch for kernels <= 2.6.24
90ifeq ($(call kver_le,2,6,24),1)
91 PATCHES := $(PATCHES) compat-2.6.24.patch
92endif
93
94# Compatibility patch for kernels <= 2.6.23
95ifeq ($(call kver_le,2,6,23),1)
96 PATCHES := $(PATCHES) compat-2.6.23.patch
97endif
98
99# Compatibility patch for kernels <= 2.6.22
100ifeq ($(call kver_le,2,6,22),1)
101 PATCHES := $(PATCHES) compat-2.6.22.patch
102endif
103
104# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
105ifeq ($(call kver_le,2,6,21),1)
106 PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
107endif
108
109# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
110ifeq ($(call kver_le,2,6,18),1)
111 PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
112endif
113
114# We don't support kernels < 2.6.14 except for explicit distros
115ifeq ($(call kver_lt,2,6,14),1)
116 UNSUPPORTED := true
117endif
118
119# Compatibility patches for SuSE distros
120ifneq ($(wildcard /etc/SuSE-release),)
121 # Compatibility patch for SLES 10 SP2
122 ifeq ($(call kver_lk,"2\.6\.16\.60-.*"),1)
123 PATCHES += compat-sles10sp2.patch
124 UNSUPPORTED :=
125 endif
126endif
127
128# Compatibility patches for Redhat distros
129ifneq ($(wildcard /etc/redhat-release),)
130 # Compatibility patch for RHEL4/CentOS4
131 ifeq ($(call kver_lk,"2\.6\.9-.*\.(EL|plus\.c4)"),1)
132 PATCHES += compat-rhel4.patch
133 UNSUPPORTED :=
134 endif
135endif
136
137MANPAGES:= ietadm.8 ietd.8 ietd.conf.5
138
139ifeq ($(MANDIR),)
140 MANPATH := $(shell (manpath 2>/dev/null || \
141 echo $MANPATH) | sed 's/:/ /g')
142 ifneq ($(MANPATH),)
143 test_dir = $(findstring $(dir), $(MANPATH))
144 else
145 test_dir = $(shell [ -e $(dir) ] && echo $(dir))
146 endif
147 MANDIR := /usr/share/man /usr/man
148 MANDIR := $(foreach dir, $(MANDIR), $(test_dir))
149 MANDIR := $(firstword $(MANDIR))
150endif
151
152ifeq ($(MANDIR),)
153 MANDIR := /usr/share/man
154endif
155
156DOCS:= ChangeLog COPYING RELEASE_NOTES README README.vmware README.initiators
157
158ifeq ($(DOCDIR),)
159 DOCDIR := /usr/share/doc/iscsitarget
160endif
161
162all: usr kernel
163
164usr: patch
165 $(MAKE) -C usr
166
167kernel: patch
168 $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel modules
169
170patch: $(UNSUPPORTED) integ_check $(PATCHES)
171
172$(UNSUPPORTED):
173 @echo "Sorry, your kernel version and/or distribution is currently"
174 @echo "not supported."
175 @echo ""
176 @echo "Please read the README file for information on how you can"
177 @echo "contribute compatibility/bug fixes to the IET project."
178 @exit 1
179
180integ_check:
181 @if [ -e .patched.* -a ! -e .patched.$(KVER) ]; then \
182 $(MAKE) unpatch; \
183 fi
184
185$(PATCHES): .patched.$(KVER)
186
187.patched.$(KVER):
188 @set -e; \
189 if [ ! -e .patched.* ]; then \
190 for p in $(PATCHES); do \
191 echo "Applying Patch $$p"; \
192 patch -p1 < patches/$$p; \
193 echo $$p >>.patched.$(KVER); \
194 done; \
195 fi
196
197unpatch:
198 @set -e; \
199 if [ -e .patched.* ]; then \
200 for p in `cat .patched.*`; do \
201 reverse="$$p $$reverse"; \
202 done; \
203 for r in $$reverse; do \
204 echo "Reversing patch $$r"; \
205 patch -p1 -R < patches/$$r; \
206 done; \
207 rm -f .patched.*; \
208 fi
209
210depmod:
211 @echo "Running depmod"
212 @if [ x$(DESTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
213 depmod -aq -b $(DESTDIR)$(INSTALL_MOD_PATH) $(KVER); \
214 else \
215 depmod -aq $(KVER); \
216 fi
217
218install-files: install-usr install-etc install-doc install-kernel
219
220install: install-files depmod
221
222install-kernel: kernel/iscsi_trgt.ko
223 @if [ -d $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) ]; then \
224 if [ -f /etc/debian_version ]; then \
225 find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
226 -name iscsi_trgt.ko -type f \
227 -exec /bin/sh -c "dpkg-divert --rename {}" \;; \
228 else \
229 find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
230 -name iscsi_trgt.ko -type f \
231 -execdir mv \{\} \{\}.orig \;; \
232 fi \
233 fi
234 @install -vD kernel/iscsi_trgt.ko \
235 $(DESTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
236
237install-usr: usr/ietd usr/ietadm
238 @install -vD usr/ietd $(DESTDIR)/usr/sbin/ietd
239 @install -vD usr/ietadm $(DESTDIR)/usr/sbin/ietadm
240
241install-etc: install-initd
242 @if [ ! -e $(DESTDIR)/etc/ietd.conf ]; then \
243 if [ ! -e $(DESTDIR)/etc/iet/ietd.conf ]; then \
244 install -vD -m 640 etc/ietd.conf \
245 $(DESTDIR)/etc/iet/ietd.conf; \
246 fi \
247 fi
248 @if [ ! -e $(DESTDIR)/etc/initiators.allow ]; then \
249 if [ ! -e $(DESTDIR)/etc/iet/initiators.allow ]; then \
250 install -vD -m 644 etc/initiators.allow \
251 $(DESTDIR)/etc/iet/initiators.allow; \
252 fi \
253 fi
254 @if [ ! -e $(DESTDIR)/etc/targets.allow ]; then \
255 if [ ! -e $(DESTDIR)/etc/iet/targets.allow ]; then \
256 install -vD -m 644 etc/targets.allow \
257 $(DESTDIR)/etc/iet/targets.allow; \
258 fi \
259 fi
260
261install-initd:
262 @if [ -f /etc/debian_version ]; then \
263 install -vD -m 755 etc/initd/initd.debian \
264 $(DESTDIR)/etc/init.d/iscsi-target; \
265 elif [ -f /etc/redhat-release ]; then \
266 install -vD -m 755 etc/initd/initd.redhat \
267 $(DESTDIR)/etc/rc.d/init.d/iscsi-target; \
268 elif [ -f /etc/gentoo-release ]; then \
269 install -vD -m 755 etc/initd/initd.gentoo \
270 $(DESTDIR)/etc/init.d/iscsi-target; \
271 elif [ -f /etc/slackware-version ]; then \
272 install -vD -m 755 etc/initd/initd \
273 $(DESTDIR)/etc/rc.d/iscsi-target; \
274 else \
275 install -vD -m 755 etc/initd/initd \
276 $(DESTDIR)/etc/init.d/iscsi-target; \
277 fi
278
279install-doc: install-man
280 @ok=true; for f in $(DOCS) ; \
281 do [ -e $$f ] || \
282 { echo $$f missing ; ok=false; } ; \
283 done ; $$ok
284 @set -e; for f in $(DOCS) ; do \
285 install -v -D -m 644 $$f \
286 $(DESTDIR)$(DOCDIR)/$$f ; \
287 done
288
289install-man:
290 @ok=true; for f in $(MANPAGES) ; \
291 do [ -e doc/manpages/$$f ] || \
292 { echo doc/manpages/$$f missing ; ok=false; } ; \
293 done ; $$ok
294 @set -e; for f in $(MANPAGES) ; do \
295 s=$${f##*.}; \
296 install -v -D -m 644 doc/manpages/$$f \
297 $(DESTDIR)$(MANDIR)/man$$s/$$f ; \
298 done
299
300uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
301
302uninstall-kernel:
303 rm -f $(DESTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
304 @if [ -f /etc/debian_version ]; then \
305 find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
306 -name iscsi_trgt.ko.distrib -type f \
307 -exec /bin/sh -c "dpkg-divert --remove --rename \
308 \`dirname {}\`/iscsi_trgt.ko" \;; \
309 else \
310 find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
311 -name iscsi_trgt.ko.orig -type f \
312 -execdir mv \{\} iscsi_trgt.ko \;; \
313 fi
314
315uninstall-usr:
316 @rm -f $(DESTDIR)/usr/sbin/ietd
317 @rm -f $(DESTDIR)/usr/sbin/ietadm
318
319uninstall-etc: uninstall-initd
320
321uninstall-initd:
322 if [ -f /etc/debian_version ]; then \
323 rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
324 elif [ -f /etc/redhat-release ]; then \
325 rm -f $(DESTDIR)/etc/rc.d/init.d/iscsi-target; \
326 elif [ -f /etc/gentoo-release ]; then \
327 rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
328 elif [ -f /etc/slackware-version ]; then \
329 rm -f $(DESTDIR)/etc/rc.d/iscsi-target; \
330 else \
331 rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
332 fi
333
334uninstall-doc: uninstall-man
335 rm -rf $(DESTDIR)$(DOCDIR)
336
337uninstall-man:
338 set -e; for f in $(MANPAGES) ; do \
339 s=$${f##*.}; \
340 rm -f $(DESTDIR)$(MANDIR)/man$$s/$$f ; \
341 done
342
343clean:
344 $(MAKE) -C usr clean
345 $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel clean
346
347distclean: unpatch clean
348 find . -name \*.orig -exec rm -f \{\} \;
349 find . -name \*.rej -exec rm -f \{\} \;
350 find . -name \*~ -exec rm -f \{\} \;
351 find . -name Module.symvers -exec rm -f \{\} \;
352
0353
=== added file '.pc/debian-changes-1.4.20.2-5/RELEASE_NOTES'
--- .pc/debian-changes-1.4.20.2-5/RELEASE_NOTES 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/RELEASE_NOTES 2011-06-29 14:00:59 +0000
@@ -0,0 +1,176 @@
1 =========================================
2 Release Notes for iSCSI Enterprise Target
3 =========================================
4
5 July 14th, 2010
6 Version 1.4.20.2
7 ----------------
8
9The IET development team is pleased to announce the release of version
101.4.20.2 of the iSCSI Enterprise Target.
11
12This release is a bugfix release. The following issues were fixed:
13- various issues in the iSNS code resulting from buffer boundaries not being
14 checked (CVE-2010-2221)
15- memory leak in the iSNS ACL code
16- the kernel module allocating UAs in atomic context could cause a soft lockup
17- handling iSCSI logins was faulty, causing issues with QLogic HBAs
18- ietd was not sufficiently protected against multiple instances
19- ietd exited when trying to remove targets with active sessions
20- MD5/SHA-1 used for CHAP authentication were faulty on big endian platforms
21
22 =========================================
23 Release Notes for iSCSI Enterprise Target
24 =========================================
25
26 April 25th, 2010
27 Version 1.4.20.1
28 ----------------
29
30The IET development team is pleased to announce the release of version
311.4.20.1 of the iSCSI Enterprise Target.
32
33This release is a bugfix release. The following issues were fixed:
34- VMWare ESX does not recognize existing IET LUs after upgrading from older IET
35 versions to 1.4.20 because of a change in the SCSI SN. The old behaviour from
36 IET versions < 1.4.20 is restored with this release. Thanks to Steffen Plotner
37 for pointing it out and helping in debugging / testing.
38- With kernel 2.6.33 the utsrelease.h used by IETs backward compatibility
39 infrastructure was moved to a new location. This lead to compilation issues
40 with kernels >= 2.6.33.
41
42
43 April 13th, 2010
44 Version 1.4.20
45 --------------
46
47The IET development team is pleased to announce the release of version
481.4.20 of the iSCSI Enterprise Target.
49
50This release includes numerous bug fixes and compatibility improvements
51and it is highly recommended that all production servers be on this
52version for compatibility and stability reasons.
53
54We would like to thank all those that contributed for this release. As
55we are a small project we rely heavily on user contributions and we
56welcome all who wish to participate in improving IET.
57
58New since 1.4.19:
59
60New Features:
61- Added ability to atomically delete all targets/sessions/connections
62- Added ability to move existing kernel module on install and move
63 back on uninstall per distribution requirements (dpkg-divert)
64- Added support for logical sector sizes (512, 1024, 2048, 4096)
65 and devices whose native sector size > 512
66- Added case insensitive volume parameter processing
67- Added ability to set temporary target redirections via ietadm
68 for existing targets
69- Added support for auto-generating MD5 hash for SCSI ID, if not
70 specified, and auto-setting SCSI SN to the hex of the SCSI ID,
71 if not specified.
72
73Experimental Features:
74- Added experimental support for multiple connections per session
75
76Updated Features:
77- Updated kernel compatibility to 2.6.33
78- Updated RPM and DKMS build/install/maintenance handling
79- Updated kernel and usr ioctl functions to perform version checking
80 between kernel module and ietd
81
82Fixes:
83- Fixed bug in ietd text final text response
84- Fixed bug with reservation release during session deletion
85- Fixed compliance issues around ABORT TASK/ABORT TASK SET
86- Fixed fileio so it should work with all file system types
87- Fixed session and connection reinstatement to work per RFC
88- Fixed performance issue with CFQ scheduler
89- Fixed corner case with fileio_sync missing last page in a sync
90- Fixed bug in ietd where an interface without an address would
91 cause it to go into an infinite loop.
92- Fixed race condition between issuing ioctls during kernel cleanup
93- Fixed race condition between ietd shutdown and initiators which
94 would cause initiators to fail to reconnect properly
95- Fixed a race condition with data-out handling with multiple
96 connections per session
97- Fixed possible wthread lost wakeup condition when the number of
98 wthreads is less then the number of CPUs/cores.
99
100
101 November 15th, 2009
102 Version 1.4.19
103 --------------
104
105The IET development team is pleased to announce the release of version
1061.4.19 of the iSCSI Enterprise Target.
107
108This release includes numerous bug fixes and compatibility improvements
109and it is highly recommended that all production servers be on this
110version for compatibility and stability reasons.
111
112We would like to thank all those that contributed for this release. As
113we are a small project we rely heavily on user contributions and we
114welcome all who wish to participate in improving IET.
115
116New since 1.4.18:
117
118- Added ability to limit number of sessions per target (MaxSessions)
119- Added NOP-In heartbeat for connections so dropped or abandoned
120 connections and their sessions close faster
121- Fixed a serious bug in initiators.allow code
122- Updated RPM .spec file with added SuSE compatibility and better
123 overall cross-platform friendliness.
124
125
126 October 5th, 2009
127 Version 1.4.18
128 --------------
129
130The version numbering of IET has changed in this release from the 0.X.X
131series to the 1.X.X series. We did this because we felt that, since IET
132has been stable and in production use for many years now, it deserved a
133version number that better reflected that stability and maturity. We
134are preserving the minor/maintenance numbers though in order to help
135maintain some consistency between prior and future releases.
136
137New since 0.4.17:
138
139- Added support for recent kernel versions up to 2.6.31
140- Added support for even more targets via:
141 * multi PDU support during discovery
142 * improved procfs support
143 * global thread pool (module parameter)
144- Added support to list all target addresses during discovery, with
145 the ability to filter those addresses via targets.allow
146- Replaced initiators.deny with an implicit deny on a failure to find
147 a match in initiators.allow while preserving backwards compatiblity
148 with existing installations (iff initiators.deny doesn't exist)
149- Added ability to filter initiators by their IQNs as well as their
150 IP addresses, using basic regex pattern to specify IQNs
151- Moved the config files to /etc/iet/ while preserving backwards
152 compatiblity with existing installations (iff a valid config file
153 exists in the new location will it be used)
154- Added support for Unit Attention Conditions
155 * SCSI RESERVE/RELEASE now issues a UAC on reservation loss
156- Added support for DKMS and building RPM packages right from the
157 source archive (from either the source tar ball or subversion)
158
159Plus many many bug and compatibility fixes (see ChangeLog for details)
160
161
162 Special thanks go to:
163 ---------------------
164
165Shreyansh Jain, Lars Ellenberg, Ming Zhang, Francois Micaux, Cheng Renquan,
166Andreas Florath, sdrb, Xie Gang, Stefan Rubner, FUJITA Tomonori, Oliver R.,
167Matthew Wild, Kevin Ye, Min Tran, Luca Berra, Kun Huang, VMware, spren,
168Jagadish Kumar, Steven Umbehocker, Emmanuel Florac, Harshal Shete,
169Tim Westervoorde, Andrei Tanas, Chris Siebenmann, Manoj Iyer, Rob Caldwell
170Pasi Karkkainen, Eugen Rieck and to all list members who submitted bug
171reports, suggestions and comments.
172
173Without whose contributions IET would not have been possible.
174
175Arne Redlich & Ross Walker
176
0177
=== added file '.pc/debian-changes-1.4.20.2-5/dkms.conf'
--- .pc/debian-changes-1.4.20.2-5/dkms.conf 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/dkms.conf 2011-06-29 14:00:59 +0000
@@ -0,0 +1,61 @@
1#
2# Master copy of dkms.conf for iscsitarget
3#
4
5PACKAGE_NAME="iscsitarget"
6PACKAGE_VERSION="1.4.20.2"
7MOD_PATH=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}
8
9BUILT_MODULE_NAME="iscsi_trgt"
10BUILT_MODULE_LOCATION="kernel"
11DEST_MODULE_LOCATION="/kernel/iscsi"
12
13MAKE="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/kernel modules"
14
15CLEAN="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/kernel clean"
16
17AUTOINSTALL="yes"
18
19#
20# Patches newest - oldest, distro spec at bottom
21#
22
23PATCH[0]="compat-2.6.32.patch"
24PATCH_MATCH[0]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32)"
25
26PATCH[1]="compat-2.6.31.patch"
27PATCH_MATCH[1]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)"
28
29PATCH[2]="compat-2.6.30.patch"
30PATCH_MATCH[2]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)"
31
32PATCH[3]="compat-2.6.29.patch"
33PATCH_MATCH[3]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)"
34
35PATCH[4]="compat-2.6.28.patch"
36PATCH_MATCH[4]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28)"
37
38PATCH[5]="compat-2.6.25-2.6.27.patch"
39PATCH_MATCH[5]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27)"
40
41PATCH[6]="compat-2.6.24.patch"
42PATCH_MATCH[6]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24)"
43
44PATCH[7]="compat-2.6.23.patch"
45PATCH_MATCH[7]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23)"
46
47PATCH[8]="compat-2.6.22.patch"
48PATCH_MATCH[8]="2\.6\.(9|14|15|16|17|18|19|20|21|22)"
49
50PATCH[9]="compat-2.6.19-2.6.21.patch"
51PATCH_MATCH[9]="2\.6\.(9|14|15|16|17|18|19|20|21)"
52
53PATCH[10]="compat-2.6.14-2.6.18.patch"
54PATCH_MATCH[10]="2\.6\.(9|14|15|16|17|18)"
55
56PATCH[11]="compat-sles10sp2.patch"
57PATCH_MATCH[11]="2\.6\.16\.60-.*"
58
59PATCH[12]="compat-rhel4.patch"
60PATCH_MATCH[12]="2\.6\.9-.*\.(el|plus\.c4)"
61
062
=== added directory '.pc/debian-changes-1.4.20.2-5/doc'
=== added directory '.pc/debian-changes-1.4.20.2-5/doc/manpages'
=== added file '.pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5'
--- .pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5 2011-06-29 14:00:59 +0000
@@ -0,0 +1,336 @@
1.\" Process this file with
2.\" groff -man -Tascii ietd.conf.5
3.\"
4.TH "IETD.CONF" "5" "27 July 2005" "A. Lehmann, M. Zhang and A. Redlich" "File formats"
5.SH "NAME"
6/etc/ietd.conf \- configuration for iSCSI Enterprise Target Daemon
7.SH "SYNOPSIS"
8/etc/ietd.conf
9.SH "DESCRIPTION"
10/etc/ietd.conf contains configuration information for the
11.B ietd (8)
12command. This is the place, where you configure your iSCSI targets and daemon defaults.
13.P
14Only lines starting with `#' are ignored. Putting '#' in the middle of a line is disallowed. A line may be extended across multiple lines by making the last character a backslash.
15.P
16The "Yes" and "No" for parameter values are case sensitive. The parameter names are case insensitive.
17.P
18The file consists of a global part and zero or more "Target" stanzas. Everything until the first target definition belongs to the global configuration.
19
20Here is an example:
21
22IncomingUser joe secret
23.br
24OutgoingUser jack secret2
25
26Target iqn.2001\-04.com.example:storage.disk2.sys1.xyz
27 IncomingUser jim othersecret
28 OutgoingUser james yetanothersecret
29 Lun 0 Path=/dev/sdc,Type=fileio
30 Lun 1 Blocks=10000,BlockSize=4096,Type=nullio
31 Alias Test
32 HeaderDigest None
33 DataDigest None
34 MaxConnections 1
35 MaxSessions 0
36 InitialR2T Yes
37 ImmediateData No
38 MaxRecvDataSegmentLength 8192
39 MaxXmitDataSegmentLength 8192
40 MaxBurstLength 262144
41 FirstBurstLength 65536
42 DefaultTime2Wait 2
43 DefaultTime2Retain 20
44 MaxOutstandingR2T 8
45 NOPInterval 0
46 NOPTimeout 0
47 DataPDUInOrder Yes
48 DataSequenceInOrder Yes
49 ErrorRecoveryLevel 0
50.P
51Stanzas start with the word "Target" and the target name. This name must be a globally unique name, as defined by the iSCSI standard : the "iSCSI Qualified Name". The daemon brings the targets up in the order listed.
52.SH "GLOBAL OPTIONS"
53Global Options are case sensitive.
54.TP
55.B [IncomingUser <username> <password>]
56The
57.I <username>
58and
59.I <password>
60used during discovery sessions to authenticate iSCSI initiators. Several of those can be specified for discovery. If no
61.B IncomingUser
62is specified, any initiator is allowed to open a discovery session.
63.RS
64HINT: RFC 3720 requires
65.I <password>
66to be 12 characters long. This is enforced e.g. by MS Initiator.
67.RE
68.TP
69.B [OutgoingUser <username> <password>]
70The
71.I <username>
72and
73.I <password>
74used during discovery sessions to authenticate the target to initiators. Only one outgoing
75.I <username>/<password>
76combination may be specified.
77.RS
78HINT: RFC 3720 requires
79.I <password>
80to be 12 characters long. This is enforced e.g. by MS Initiator.
81.RE
82.TP
83.B Target iqn.<yyyy\-mm>.<tld.domain.some.host>[:<identifier>]
84A target definition and the target name. The targets name (the
85.B iSCSI Qualified Name
86) must be a globally unique name (as defined by the iSCSI standard) and has to start with
87.I iqn
88followed by a single dot. The EUI\-64 form is not supported.
89.I <yyyy\-mm>
90is the date (year and month) at which the domain is valid. This has to be followed by a single dot and the reversed domain name.
91The optional
92.I <identifier>
93\- which is freely selectable \- has to be separated by a single colon. For further details please check the iSCSI spec.
94
95Here is an example:
96
97Target iqn.2004\-07.com.example.host:storage.disk2.sys1.xyz
98.SH "TARGET OPTIONS"
99Target options are also case sensitive.
100.TP
101.B [IncomingUser <username> <password>]
102The
103.I <username>
104and
105.I <password>
106used to authenticate the iSCSI initiators to this target. It may be different from the username and password in section GLOBAL OPTIONS, which is used for discovery. If you omit the
107.B IncomingUser
108Option, connections are allowed without authentication. A
109.I <password>
110has to be provided, if there is a
111.I <username>
112given. Specifying several different
113.B IncomingUser
114accounts is supported.
115.TP
116.B [OutgoingUser <username> <password>]
117The
118.I <username>
119and
120.I <password>
121used to authenticate this iSCSI target to initiators. Only one
122.B
123OutgoingUser
124per target is supported. It may be different from the username and password in section GLOBAL OPTIONS, which is used for discovery. A
125.I <password>
126has to be provided, if there is a
127.I <username>
128given.
129.TP
130.nf
131.B Lun <lun> Type=(fileio|blockio),Path=<device>[,ScsiId=<scsi_id>][,ScsiSN=<scsi_sn>][,IOMode=(wb|ro|wt)][,BlockSize=<size>]
132.TP
133.B Lun <lun> Type=nullio[,Blocks=<count>][,BlockSize=<size>]
134.fi
135.RS
136Parameters after <lun> should not contain any blank space characters except the first blank space after <lun> is needed.
137.P
138The value of
139.I <lun>
140can be from 0 to 16384. The first
141.I <lun>
142defined MUST be 0.
143.P
144In
145.I fileio
146mode (default), it defines a mapping between a "Logical Unit Number"
147.I <lun>
148and a given device
149.I <device>
150, which can be any block device (including regular block devices like hdX and sdX and virtual block devices like LVM and Software RAID devices) or regular files.
151.P
152In
153.I blockio
154mode, it defines a mapping between a "Logical Unit Number"
155.I <lun>
156and a given block device
157.I <device>.
158This mode will perform direct block i/o with the device, bypassing page-cache for all operations. This allows for efficient handling of non-aligned sector transfers (virtualized environments) and large block transfers (media servers). This mode works ideally with high-end storage HBAs and for applications that either do not need caching between application and disk or need the large block throughput.
159.P
160A
161.I ScsiId
162can be specified to assign a unique SCSI ID (VPD 0x83) to an iSCSI volume. This is used by initiator hosts to uniquely identify a SCSI volume. This is necessary with multipath\-aware hosts accessing the same
163.I <device>
164through multiple iSCSI sessions. The
165.I <scsi_id>
166must not exceed 16 characters.
167.P
168Also a
169.I ScsiSN
170can be specified to assign a unique serial number (VPD 0x80) to an iSCSI volume. This is used by certain initiator hosts (e.g. VMware ESX) to uniquely identify a SCSI volume. This is essential when used in conjunction with VMware ESX hosts accessing the same
171.I <device>
172through multiple iSCSI sessions. The
173.I <scsi_sn>
174must not exceed 16 characters.
175.P
176By default LUNs are writable, employing write-through caching. By setting
177.I IOMode
178to "ro" a LUN can be set to read only mode. Setting
179.I IOMode
180to "wb" will enable write-back caching of a LUN. Setting
181.I IOMode
182to "wt" is only symbolic as that is the default behavior.
183.P
184.B NOTE:
185.I IOMode
186"wb" is ignored when employing blockio as it performs no caching.
187.P
188.B WARNING: IOMode=wb could lead to serious data loss from an unexpected system failure (power loss, system crash). Use at your own risk!
189.P
190You can specify a logical
191.I BlockSize
192for an iSCSI volume. This
193.I <size>
194must be one of (512, 1024, 2048, 4096). If
195.I BlockSize
196isn't specified the default is 512 bytes for fileio, and the logical block size of the lower level device for blockio (which typically is 512 bytes).
197.P
198.B NOTE:
199For blockio, you CANNOT specify a
200.I BlockSize
201less than the lower level device's logical block size which is the minimum size the device can handle. An error will be reported and the LUN will fail to attach if you try. You CAN use fileio though to export a LUN with a
202.I BlockSize
203less than the lower level device's logical block size.
204.P
205.B WARNING: Once your data is written at a given BlockSize you cannot change this BlockSize without risking corruption of your existing data.
206.P
207In
208.I nullio
209mode, it defines a mapping between a "Logical Unit Number"
210.I <lun>
211and an unnamed virtual device with a specified number of
212.I Blocks
213of
214.I BlockSize
215bytes. If
216.I Blocks
217is not specified then it will default to 64GB's worth given the curent
218.I BlockSize
219which defaults to 512 bytes. This is ONLY useful for performance measurement purposes. All writes to this virtual device will be discarded and all reads will return random data.
220.P
221.B WARNING: By sending random kernel memory over the IP network you can potentially expose sensitive information.
222.RE
223.TP
224.B [Alias <aliasname>]
225This assigns an optional
226.I <aliasname>
227to the target.
228.TP
229.B [HeaderDigest <CRC32C|None>]
230Optional. If set to "CRC32C" and the initiator is configured accordingly, the integrity of an iSCSI PDU's header segments will be protected by a CRC32C checksum. The default is "None". Note that header digests are not supported during discovery sessions.
231.TP
232.B [DataDigest <CRC32C|None>]
233Optional. If set to "CRC32C" and the initiator is configured accordingly, the integrity of an iSCSI PDU's data segment will be protected by a CRC32C checksum. The default is "None". Note that data digests are not supported during discovery sessions.
234.TP
235.B [MaxConnections <value>]
236Optional. The number of connections within a session. Has to be set to "1" (in words: one), which is also the default since MC/S is not supported.
237.TP
238.B [MaxSessions <value>]
239Optional. The maximum number of sessions for this target. If this is set to 0 (wich is the default) there is no explicit session limit.
240.TP
241.B [InitialR2T <Yes|No>]
242Optional. If set to "Yes" (default), the initiator has to wait for the target to solicit SCSI data before sending it. Setting it to "No" allows the initiator to send a burst of
243.B FirstBurstLength
244bytes unsolicited right after and/or (depending on the setting of
245.B ImmediateData
246) together with the command. Thus setting it to "No" may improve performance.
247.TP
248.B [ImmediateData <Yes|No>]
249Optional. This allows the initiator to append unsolicited data to a command. To achieve better performance, this should be set to "Yes". The default is "No".
250.TP
251.B [MaxRecvDataSegmentLength <value>]
252Optional. Sets the maximum data segment length that can be received. The
253.I <value>
254should be set to multiples of PAGE_SIZE. Currently the maximum supported value is 64 * PAGE_SIZE, e.g. 262144 if PAGE_SIZE is 4kB. Configuring too large values may lead to problems allocating sufficient memory, which in turn may lead to SCSI commands timing out at the initiator host. The default value is 8192.
255.TP
256.B [MaxXmitDataSegmentLength <value>]
257Optional. Sets the maximum data segment length that can be sent. The
258.I <value>
259actually used is the minimum of
260.B MaxXmitDataSegmentLength
261and the
262.B MaxRecvDataSegmentLength
263announced by the initiator. The
264.I <value>
265should be set to multiples of PAGE_SIZE. Currently the maximum supported value is 64 * PAGE_SIZE, e.g. 262144 if PAGE_SIZE is 4kB. Configuring too large values may lead to problems allocating sufficient memory, which in turn may lead to SCSI commands timing out at the initiator host. The default value is 8192.
266.TP
267.B [MaxBurstLength <value>]
268Optional. Sets the maximum amount of either unsolicited or solicited data the initiator may send in a single burst. Any amount of data exceeding this value must be explicitly solicited by the target. The
269.I <value>
270should be set to multiples of PAGE_SIZE. Configuring too large values may lead to problems allocating sufficient memory, which in turn may lead to SCSI commands timing out at the initiator host. The default value is 262144.
271.TP
272.B [FirstBurstLength <value>]
273Optional. Sets the amount of unsolicited data the initiator may transmit in the first burst of a transfer either with and/or right after the command, depending on the settings of
274.B InitialR2T
275and
276.B ImmediateData
277.
278.I <value>
279should be set to multiples of PAGE_SIZE. Configuring too large values may lead to problems allocating sufficient memory, which in turn may lead to SCSI commands timing out at the initiator host. The default value is 65536.
280.TP
281.B [DefaultTime2Wait <value>]
282Currently not supported.
283.TP
284.B [DefaultTime2Retain <value>]
285Currently not supported.
286.TP
287.B [MaxOutstandingR2T <value>]
288Optional. Controls the maximum number of data transfers the target may request at once, each of up to
289.B MaxBurstLength
290bytes. The default is 1.
291.TP
292.B [DataPDUInOrder <Yes|No>]
293Optional. Has to be set to "Yes" \- which is also the default.
294.TP
295.B [DataSequenceInOrder <Yes|No>]
296Optional. Has to be set to "Yes" \- which is also the default.
297.TP
298.B [ErrorRecoveryLevel <value>]
299Optional. Has to be set to "0" (in words: zero), which is also the default.
300.TP
301.B [NOPInterval <value>]
302Optional. If
303.I value
304is non-zero, the initiator will be "ping"ed during phases of inactivity (i.e. no data transfers) every
305.I value
306seconds to verify the connection is still alive. If the initiator fails to respond within
307.B NOPTimeout
308seconds, the connection will be closed.
309.TP
310.B [NOPTimeout <value>]
311Optional. If a non-zero
312.B NOPInterval
313is used to periodically "ping" the initiator during phases of inactivity (i.e. no data transfers), the initiator must respond within
314.I value
315seconds, otherwise the connection will be closed. If
316.I value
317is set to zero or if it exceeds
318.B NOPInterval
319, it will be set to
320.B NOPInterval.
321.TP
322.B [Wthreads <value>]
323Optional. The iSCSI target employs several threads to perform the actual block I/O to the device. Depending on your hardware and your (expected) workload, the number of these threads may be carefully adjusted. The default value of 8 should be sufficient for most purposes.
324.TP
325.B [QueuedCommands <value>]
326Optional. This parameter defines a window of commands an initiator may send and that will be buffered by the target. Depending on your hardware and your (expected) workload, the
327.I value
328may be carefully adjusted. The default value of 32 should be sufficient for most purposes.
329.SH "KNOWN BUGS/LIMITATIONS"
330Currently (as of 0.4.11) not all iSCSI target parameters are used. Header and data digests are not supported during discovery sessions.
331.SH "SEE ALSO"
332.B ietd (8)
333.TP
334You should have a look at
335.B RFC 3720
336for all the glory details.
0337
=== added directory '.pc/debian-changes-1.4.20.2-5/etc'
=== added file '.pc/debian-changes-1.4.20.2-5/etc/ietd.conf'
--- .pc/debian-changes-1.4.20.2-5/etc/ietd.conf 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/etc/ietd.conf 2011-06-29 14:00:59 +0000
@@ -0,0 +1,110 @@
1# Example iscsi target configuration
2#
3# Everything until the first target definition belongs
4# to the global configuration.
5#
6# "iSNSServer" is the iSNS server you want your portal to register
7# with.
8#
9# "iSNSAccessControl" is for enabling initiator access control
10# through the iSNS server.
11#
12# "IncomingUser" specifies credentials the initiator has to provide -
13# several of these are supported. If mutual CHAP shall be employed,
14# "OutgoingUser" specifies the user/pass combination the target will
15# provide - only one is supported.
16#
17# Leave them alone (keep them commented out) if you don't want to use
18# authentication for discovery sessions.
19
20#iSNSServer 192.168.1.16
21#iSNSAccessControl No
22
23#IncomingUser joe secret
24#OutgoingUser jack 12charsecret
25
26# Targets definitions start with "Target" and the target name.
27# The target name must be a globally unique name, the iSCSI
28# standard defines the "iSCSI Qualified Name" as follows:
29#
30# iqn.yyyy-mm.<reversed domain name>[:identifier]
31#
32# "yyyy-mm" is the date at which the domain is valid and the identifier
33# is freely selectable. For further details please check the iSCSI spec.
34
35#Target iqn.2001-04.com.example:storage.disk2.sys1.xyz
36 # CHAP Users
37 #
38 # The same rules as for discovery users apply here.
39 #
40 # Don't set them if you don't want to use CHAP authentication.
41 #
42 #IncomingUser joe secret
43 #OutgoingUser jim 12charpasswd
44 #
45 # Logical Unit definition
46 #
47 # Block devices, regular files (fileio only), LVM, and RAID
48 # can be offered to the initiators as a block device.
49 #
50 # Lun numbers MUST start with zero (each target needs a Lun 0)
51 #
52 #Lun 0 Path=/dev/sdc,Type=fileio,ScsiId=xyz,ScsiSN=xyz
53 #
54 # Alias name for this target (Not Used)
55 #
56 #Alias Test
57 #
58 # Various iSCSI parameters
59 # (not all are used right now, see also iSCSI spec for details)
60 #
61 # Outgoing SCSI data (initiator to target user data or command
62 # parameters) is sent as either solicited data or unsolicited data.
63 # Solicited data is sent in response to R2T PDUs. Unsolicited data
64 # can be sent as part of an iSCSI command PDU sequence
65 # ("Immediate Data") or as a separate iSCSI data PDU sequence.
66 #
67 #MaxConnections 1 # Number of connections/session
68 # We only support 1
69 #MaxSessions 0 # Number of sessions/target
70 # 0 = no explicit limit
71 #InitialR2T Yes # Wait first for R2T
72 # Yes = no unsolicited data
73 #ImmediateData Yes # Data can accompany command
74 # Yes = cmnd/data in same PDU
75 #MaxRecvDataSegmentLength 8192 # Max data per PDU to receive
76 #MaxXmitDataSegmentLength 8192 # Max data per PDU to transmit
77 #MaxBurstLength 262144 # Max data per sequence (R2T)
78 #FirstBurstLength 65536 # Max unsolicited data sequence
79 #DefaultTime2Wait 2 # Secs wait for ini to log out
80 # Not used
81 #DefaultTime2Retain 20 # Secs keep cmnds after log out
82 # Not used
83 #MaxOutstandingR2T 1 # Max outstanding R2Ts per cmnd
84 #DataPDUInOrder Yes # Data in PDUs is ordered
85 # We only support ordered
86 #DataSequenceInOrder Yes # PDUs in sequence are ordered
87 # We only support ordered
88 #ErrorRecoveryLevel 0 # We only support level 0
89 #HeaderDigest None,CRC32C # PDU header checksum algo list
90 # None or CRC32C
91 # If only one is set then the
92 # initiator must agree to it
93 # or the connection will fail
94 #DataDigest None,CRC32C # PDU data checksum algo list
95 # Same as above
96 #MaxSessions 0 # Maximum number of sessions to
97 # this target - 0 = unlimited
98 #NOPInterval 0 # Send a NOP-In ping each after
99 # that many seconds if the conn
100 # is otherwise idle - 0 = off
101 #NOPTimeout 0 # Wait that many seconds for a
102 # response on a NOP-In ping
103 # If 0 or > NOPInterval, NOPInterval
104 # is used!
105 #
106 # Various target parameters
107 #
108 #Wthreads 8 # Number of IO threads
109 #QueuedCommands 32 # Number of queued commands
110
0111
=== added directory '.pc/debian-changes-1.4.20.2-5/etc/initd'
=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd'
--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd 2011-06-29 14:00:59 +0000
@@ -0,0 +1,39 @@
1#!/bin/bash
2#
3# Start the iSCSI Enterprise Target.
4#
5
6PATH=/sbin:/bin:/usr/sbin:/usr/bin
7OPTIONS=""
8
9if [ -f /etc/sysconfig/iscsi-target ]; then
10 . /etc/sysconfig/iscsi-target
11fi
12
13start_server()
14{
15 modprobe -q crc32c
16 modprobe iscsi_trgt
17 /usr/sbin/ietd $OPTIONS
18}
19
20stop_server()
21{
22 ietadm --op delete
23 killall ietd
24}
25
26case "$1" in
27 start)
28 start_server
29 ;;
30 stop)
31 stop_server
32 ;;
33 *)
34 echo "Usage: {start|stop}" >&2
35 exit 1
36 ;;
37esac
38
39exit 0
040
=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian'
--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian 2011-06-29 14:00:59 +0000
@@ -0,0 +1,75 @@
1#!/bin/sh
2#
3# chkconfig: - 39 35
4# description: Starts and stops the iSCSI target
5# debianized start-stop script
6
7PATH=/sbin:/bin:/usr/sbin:/usr/bin
8DAEMON=/usr/sbin/ietd
9OPTIONS=""
10PIDFILE=/var/run/iscsi_trgt.pid
11
12if [ -f /lib/init/vars.sh ]; then
13 . /lib/init/vars.sh
14fi
15
16if [ -f /lib/lsb/init-functions ]; then
17 . /lib/lsb/init-functions
18fi
19
20if [ -f /etc/sysconfig/iscsi-target ]; then
21 . /etc/sysconfig/iscsi-target
22fi
23
24RETVAL=0
25
26ietd_start()
27{
28 log_daemon_msg "Starting iSCSI Target" "ietd"
29 modprobe -q crc32c
30 modprobe iscsi_trgt
31 start-stop-daemon --start --exec $DAEMON --pidfile $PIDFILE -- $OPTIONS
32 log_end_msg $?
33}
34
35ietd_stop()
36{
37 log_daemon_msg "Stopping iSCSI Target" "ietd"
38 ietadm --op delete
39 start-stop-daemon --stop --exec $DAEMON --pidfile $PIDFILE
40 rm -f $PIDFILE
41 log_end_msg $?
42}
43
44ietd_status()
45{
46 PID=`pidof ietd`
47 if [ $PID ]; then
48 echo "iSCSI Target (pid $PID) is running..."
49 else
50 echo "iSCSI Target is stopped."
51 exit 1
52 fi
53}
54
55case "$1" in
56 start)
57 ietd_start
58 ;;
59 stop)
60 ietd_stop
61 ;;
62 restart)
63 ietd_stop
64 sleep 1
65 ietd_start
66 ;;
67 status)
68 ietd_status
69 ;;
70 *)
71 echo $"Usage: $0 {start|stop|restart|status}"
72 exit 1
73esac
74
75exit 0
076
=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo'
--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo 2011-06-29 14:00:59 +0000
@@ -0,0 +1,39 @@
1#!/sbin/runscript
2#
3# Start the iSCSI Enterprise Target.
4#
5# To define start-up options, create a config file called
6# /etc/conf.d/iscsi-target, in it define OPTIONS="...".
7
8depend()
9{
10 use net
11 need localmount
12 after bootmisc
13}
14
15start()
16{
17 ebegin "Starting iSCSI Target"
18 modprobe -q crc32c
19 modprobe iscsi_trgt
20 start-stop-daemon --start --exec /usr/sbin/ietd --pidfile /var/run/iscsi_trgt.pid -- $OPTIONS
21 eend $?
22}
23
24stop()
25{
26 ebegin "Stopping iSCSI Target"
27 ietadm --op delete
28 start-stop-daemon --stop --exec /usr/sbin/ietd --pidfile /var/run/iscsi_trgt.pid
29 rm -f /var/run/iscsi_trgt.pid
30 eend $?
31}
32
33restart()
34{
35 stop
36 sleep 1
37 start
38}
39
040
=== added directory '.pc/debian-changes-1.4.20.2-5/include'
=== added file '.pc/debian-changes-1.4.20.2-5/include/iet_u.h'
--- .pc/debian-changes-1.4.20.2-5/include/iet_u.h 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/include/iet_u.h 2011-06-29 14:00:59 +0000
@@ -0,0 +1,151 @@
1#ifndef _IET_U_H
2#define _IET_U_H
3
4#define IET_VERSION_STRING "1.4.20.2"
5
6/* The maximum length of 223 bytes in the RFC. */
7#define ISCSI_NAME_LEN 256
8#define ISCSI_ARGS_LEN 2048
9
10#define ISCSI_LISTEN_PORT 3260
11
12#define SCSI_ID_LEN 16
13#define SCSI_SN_LEN (SCSI_ID_LEN * 2)
14
15#ifndef aligned_u64
16#define aligned_u64 unsigned long long __attribute__((aligned(8)))
17#endif
18
19struct module_info {
20 char version[128];
21};
22
23struct target_info {
24 u32 tid;
25 char name[ISCSI_NAME_LEN];
26};
27
28struct volume_info {
29 u32 tid;
30 u32 lun;
31 aligned_u64 args_ptr;
32 u32 args_len;
33};
34
35struct session_info {
36 u32 tid;
37
38 aligned_u64 sid;
39 char initiator_name[ISCSI_NAME_LEN];
40 u32 exp_cmd_sn;
41 u32 max_cmd_sn;
42};
43
44#define DIGEST_ALL (DIGEST_NONE | DIGEST_CRC32C)
45#define DIGEST_NONE (1 << 0)
46#define DIGEST_CRC32C (1 << 1)
47
48struct conn_info {
49 u32 tid;
50 aligned_u64 sid;
51
52 u32 cid;
53 u32 stat_sn;
54 u32 exp_stat_sn;
55 int header_digest;
56 int data_digest;
57 int fd;
58};
59
60enum {
61 key_initial_r2t,
62 key_immediate_data,
63 key_max_connections,
64 key_max_recv_data_length,
65 key_max_xmit_data_length,
66 key_max_burst_length,
67 key_first_burst_length,
68 key_default_wait_time,
69 key_default_retain_time,
70 key_max_outstanding_r2t,
71 key_data_pdu_inorder,
72 key_data_sequence_inorder,
73 key_error_recovery_level,
74 key_header_digest,
75 key_data_digest,
76 key_ofmarker,
77 key_ifmarker,
78 key_ofmarkint,
79 key_ifmarkint,
80 session_key_last,
81};
82
83enum {
84 key_wthreads,
85 key_target_type,
86 key_queued_cmnds,
87 key_nop_interval,
88 key_nop_timeout,
89 target_key_last,
90};
91
92enum {
93 key_session,
94 key_target,
95};
96
97struct iscsi_param_info {
98 u32 tid;
99 aligned_u64 sid;
100
101 u32 param_type;
102 u32 partial;
103
104 u32 session_param[session_key_last];
105 u32 target_param[target_key_last];
106};
107
108enum iet_event_state {
109 E_CONN_CLOSE,
110};
111
112struct iet_event {
113 u32 tid;
114 aligned_u64 sid;
115 u32 cid;
116 u32 state;
117};
118
119#define DEFAULT_NR_WTHREADS 8
120#define MIN_NR_WTHREADS 1
121#define MAX_NR_WTHREADS 128
122
123#define DEFAULT_NR_QUEUED_CMNDS 32
124#define MIN_NR_QUEUED_CMNDS 1
125#define MAX_NR_QUEUED_CMNDS 256
126
127#define DEFAULT_NOP_INTERVAL 0
128#define MIN_NOP_INTERVAL 0
129#define MAX_NOP_INTERVAL 90
130
131#define DEFAULT_NOP_TIMEOUT 0
132#define MIN_NOP_TIMEOUT 0
133#define MAX_NOP_TIMEOUT 90
134
135#define NETLINK_IET 21
136
137#define GET_MODULE_INFO _IOW('i', 20, struct module_info)
138#define ADD_TARGET _IOWR('i', 21, struct target_info)
139#define DEL_TARGET _IOW('i', 22, struct target_info)
140#define ADD_VOLUME _IOW('i', 24, struct volume_info)
141#define DEL_VOLUME _IOW('i', 25, struct volume_info)
142#define ADD_SESSION _IOW('i', 26, struct session_info)
143#define DEL_SESSION _IOW('i', 27, struct session_info)
144#define GET_SESSION_INFO _IOWR('i', 28, struct session_info)
145#define ADD_CONN _IOW('i', 29, struct conn_info)
146#define DEL_CONN _IOW('i', 30, struct conn_info)
147#define GET_CONN_INFO _IOWR('i', 31, struct conn_info)
148#define ISCSI_PARAM_SET _IOW('i', 32, struct iscsi_param_info)
149#define ISCSI_PARAM_GET _IOWR('i', 33, struct iscsi_param_info)
150
151#endif
0152
=== added file '.pc/debian-changes-1.4.20.2-5/iscsitarget.spec'
--- .pc/debian-changes-1.4.20.2-5/iscsitarget.spec 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/iscsitarget.spec 2011-06-29 14:00:59 +0000
@@ -0,0 +1,507 @@
1##
2## Global Package Definitions
3##
4
5## IET Release
6%define iet_version 1.4.20.2
7
8## Package Revision
9%define revision 1
10
11## Build Options (modify to tune your build)
12# Build DKMS kernel module
13#
14# Two passes through rpmbuild are required, once for the userland
15# binary package and another time with --target=noarch for the
16# kernel dkms package.
17%define dkms 0
18
19# Build weak modules (KABI tracking) if supported
20#
21# If it isn't supported it will figure that out below
22%define weak 1
23
24# Build from SVN repository
25%define svn 0
26%define svn_rev HEAD
27%define svn_repo https://iscsitarget.svn.sourceforge.net/svnroot/iscsitarget
28
29## Platform Definitions (you shouldn't need to modify these)
30# Determine distribution
31%define is_suse !%(test -e /etc/SuSE-release; echo $?)
32%define is_fedora !%(test -e /etc/fedora-release; echo $?)
33%define is_redhat !%(test -e /etc/redhat-release; echo $?)
34%define is_mandrake !%(test -e /etc/mandrake-release; echo $?)
35%define is_mandriva !%(test -e /etc/mandriva-release; echo $?)
36
37# Define kernel version information
38%{!?kernel: %define kernel %(uname -r)}
39
40%define kver %(echo %{kernel} | sed -e 's/default//' -e 's/pae//i' -e 's/xen//' -e 's/smp//' -e 's/bigmem//' -e 's/hugemem//' -e 's/enterprise//' -e 's/-$//')
41%define krel %(echo %{kver} | sed -e 's/-/_/g')
42%define ktype %(echo kernel-%{kernel} | sed -e 's/%{kver}//' -e 's/--/-/' -e 's/-$//')
43
44%define moddir /lib/modules/%{kernel}
45
46# Set location of tools
47%{!?__chkconfig: %define __chkconfig /sbin/chkconfig}
48%{!?__depmod: %define __depmod /sbin/depmod}
49%{!?__dkms: %define __dkms /usr/sbin/dkms}
50%{!?__find: %define __find /usr/bin/find}
51%{!?__modprobe: %define __modprobe /sbin/modprobe}
52%{!?__service: %define __service /sbin/service}
53%{!?__svn: %define __svn /usr/bin/svn}
54%if %is_suse
55%{!?__weak_modules: %define __weak_modules /usr/lib/module-init-tools/weak-modules}
56%else
57%{!?__weak_modules: %define __weak_modules /sbin/weak-modules}
58%endif
59
60# Subversion build information
61%if %svn
62%if !%(test "%{iet_version}" = "trunk"; echo $?)
63%define svn_url %{svn_repo}/trunk
64%define svn_ver %(%{__svn} info -r %{svn_rev} --non-interactive %{svn_url} | awk '{if ($1 == "Revision:") {print "r"$2}}')
65%else
66%define svn_url %{svn_repo}/tags/%{iet_version}
67%endif
68%endif
69
70# Build weak module (KABI Tracking) on platforms that support it
71%if %weak
72%define weak !%(test -x %{__weak_modules}; echo $?)
73%endif
74
75# Basic regex filters for unwanted dependencies (used for weak modules)
76%if %weak
77%define pro_filter ""
78%if %is_redhat
79%define req_filter "\\(fsync_bdev\\|sync_page_range\\|vfs_write\\|get_io_context\\|copy_io_context\\|put_io_context\\)"
80%else
81%define req_filter ""
82%endif
83%endif
84
85# Define build user
86%define user %(whoami)
87
88
89##
90## Userland Package
91##
92
93## Information
94Summary: iSCSI Enterprise Target
95Name: iscsitarget
96Version: %{?svn_ver: %{iet_version}_%{svn_ver}}%{!?svn_ver: %{iet_version}}
97Release: %{?revision: %{revision}}%{!?revision: 1}
98License: GPL
99Group: System Environment/Daemons
100URL: http://sourceforge.net/projects/iscsitarget/
101Packager: IET development team <iscsitarget-devel@lists.sourceforge.net>
102
103## Source files
104%if !%svn
105Source0: %{name}-%{version}.tar.gz
106%endif
107
108## Patches
109#Patch0: %{name}-%{version}-example.p
110
111## Install Requirements
112Requires: %{name}-kmod = %{version}
113
114## Build Requirements
115BuildRequires: kernel >= 2.6
116BuildRequires: gcc, make, patch, binutils, /usr/bin/install, openssl-devel
117%if %is_suse
118BuildRequires: kernel-source = %{kver}
119%else
120BuildRequires: %{ktype}-devel = %{kver}
121%endif
122%if %svn
123BuildRequires: subversion
124%endif
125
126## Build Definitions
127BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{user}
128
129## Description
130%description
131iSCSI Enterprise Target
132
133
134##
135## Kernel Module Package
136##
137%if %dkms
138%ifarch noarch
139%package -n dkms-%{name}
140
141## Information
142Summary: iSCSI Enterprise Target kernel module
143Group: System Environment/Kernel
144Release: %{release}
145
146## Install Requirements
147Requires: dkms >= 2, gcc, make, patch, binutils
148%if %is_suse
149Requires: kernel-source
150%else
151Requires: %{ktype}-devel
152%endif
153
154## Install Provides
155Provides: kernel-modules
156Provides: %{name}-kmod = %{version}
157
158## Install Conflicts
159Conflicts: kmod-%{name}
160
161## Description
162%description -n dkms-%{name}
163iSCSI Enterprise Target kernel module
164%endif
165%else
166%package -n kmod-%{name}
167
168## Information
169Summary: iSCSI Enterprise Target kernel module
170Group: System Environment/Kernel
171Release: %{release}_%{krel}
172
173## Install Requirements
174%if %weak
175Requires: %{ktype}
176Requires(post): %{__weak_modules}
177Requires(postun): %{__weak_modules}
178%else
179Requires: %{ktype} = %{kver}
180%endif
181Requires(post): %{__depmod}
182Requires(postun): %{__depmod}
183
184## Install Provides
185%if !%weak
186Provides: kernel-modules = %{kver}
187%endif
188Provides: %{name}-kmod = %{version}
189
190## Install Conflicts
191Conflicts: dkms-%{name}
192
193## Description
194%description -n kmod-%{name}
195iSCSI Enterprise Target kernel module
196%endif
197
198
199##
200## Package Creation
201##
202
203## Preparation
204%prep
205
206
207## Setup
208%if %svn
209%setup -q -D -T -c -n %{name}-%{version}
210if [ ! -f include/iet_u.h ]; then
211%{__svn} export --force -r %{svn_rev} --non-interactive -q %{svn_url} .
212%{__sed} -i -e "s/\(#define IET_VERSION_STRING\).*/\1\t\"%{version}\"/" include/iet_u.h
213# Patches to apply to SVN
214#%patch0 -p0
215fi
216%else
217%setup -q -n %{name}-%{version}
218# Patches to apply to release
219#%patch0 -p0
220%endif
221
222
223## Build
224%build
225%{__make} distclean
226%ifnarch noarch
227%if %dkms
228%{__make} usr
229%else
230%{__make}
231%endif
232%endif
233
234
235## Installation
236%install
237%{__rm} -rf %{buildroot}
238
239%ifnarch noarch
240%if %dkms
241%{__make} install-usr install-doc install-etc DISTDIR=%{buildroot} DESTDIR=%{buildroot}
242%else
243%{__make} install-usr install-doc install-etc install-kernel DISTDIR=%{buildroot} DESTDIR=%{buildroot}
244%{__rm} -f %{buildroot}/lib/modules/%{kernel}/modules.*
245%if !%(test -d %{buildroot}%{moddir}/extra/iscsi; echo $?)
246%define module %{moddir}/extra/iscsi/iscsi_trgt.ko
247%else
248%define module %{moddir}/kernel/iscsi/iscsi_trgt.ko
249%endif
250%endif
251%if %is_redhat || %is_fedora
252if [ -d %{buildroot}/etc/init.d ]; then
253 %{__mkdir} %{buildroot}/etc/rc.d
254 %{__mv} %{buildroot}/etc/init.d %{buildroot}/etc/rc.d
255fi
256%endif
257%if %(test -d %{buildroot}/etc/iet; echo $?)
258%define ietd_conf %{_sysconfdir}/iet/ietd.conf
259%define initiators_allow %{_sysconfdir}/iet/initiators.allow
260%define targets_allow %{_sysconfdir}/iet/targets.allow
261%else
262%define ietd_conf %{_sysconfdir}/ietd.conf
263%define initiators_allow %{_sysconfdir}/initiators.allow
264%define targets_allow %{_sysconfdir}/initiators.deny
265%endif
266%elseif %dkms
267%{__mkdir} -p %{buildroot}/usr/src/%{name}-%{version}
268%{__cp} -r COPYING dkms.conf include kernel patches %{buildroot}/usr/src/%{name}-%{version}
269%{__sed} -i -e "s/\(PACKAGE_VERSION=\).*/\1\"%{version}\"/" %{buildroot}/usr/src/%{name}-%{version}/dkms.conf
270%endif
271
272# Ugly hack to filter out unwanted dependencies
273%if %weak
274%global _use_internal_dependency_generator 0
275%if !%(test -n "%{pro_filter}"; echo $?)
276%define iet_provides %{_tmppath}/iet_provides-%{user}
277%{__cat} << EOF > %{iet_provides}
278%{__find_provides} "\$@" | %{__grep} -v %{pro_filter}
279exit 0
280EOF
281%{__chmod} 755 %{iet_provides}
282%define __find_provides %{iet_provides}
283%endif
284%if !%(test -n "%{req_filter}"; echo $?)
285%define iet_requires %{_tmppath}/iet_requires-%{user}
286%{__cat} << EOF > %{iet_requires}
287%{__find_requires} "\$@" | %{__grep} -v %{req_filter}
288exit 0
289EOF
290%{__chmod} 755 %{iet_requires}
291%define __find_requires %{iet_requires}
292%endif
293%endif
294
295
296## Cleaning
297%clean
298%{__rm} -rf %{buildroot}
299%if %{?iet_provides:1}%{!?iet_provides:0}
300%{__rm} -f %{iet_provides}
301%endif
302%if %{?iet_requires:1}%{!?iet_requires:0}
303%{__rm} -f %{iet_requires}
304%endif
305
306
307## Post-Install Script
308%ifnarch noarch
309%post
310%if %is_suse
311%{__ln} -s %{_initrddir}/iscsi-target %{_sbindir}/rciscsi-target
312%endif
313%{__chkconfig} --add iscsi-target
314%endif
315
316
317## Pre-Uninstall Script
318%ifnarch noarch
319%preun
320if [ "$1" = 0 ]; then
321 %{__service} iscsi-target stop &>/dev/null
322 %{__chkconfig} --del iscsi-target &>/dev/null
323fi
324%if %is_suse
325%{__rm} -f %{_sbindir}/rciscsi-target
326%endif
327%endif
328
329
330## Post-Uninstall Script
331%ifnarch noarch
332%postun
333if [ "$1" != 0 ]; then
334 %{__service} iscsi-target condrestart &>/dev/null
335fi
336%endif
337
338
339## Post-Install Script (Kernel Module)
340%if %dkms
341%ifarch noarch
342%post -n dkms-%{name}
343%{__dkms} add -m %{name} -v %{version} --rpm_safe_upgrade
344%{__dkms} build -m %{name} -v %{version}
345%{__dkms} install -m %{name} -v %{version} --force
346%endif
347%else
348%post -n kmod-%{name}
349%{__depmod} %{kernel} -a
350%if %weak
351if [ -x %{__weak_modules} ]; then
352 echo %{module} | %{__weak_modules} --add-modules
353fi
354%endif
355%endif
356
357
358## Pre-Uninstall Script (Kernel Module)
359%if %dkms
360%ifarch noarch
361%preun -n dkms-%{name}
362%{__dkms} remove -m %{name} -v %{version} --all --rpm_safe_upgrade
363%endif
364%else
365%preun -n kmod-%{name}
366%{__modprobe} -r -q --set-version %{kernel} iscsi_trgt
367%if %weak
368if [ -x %{__weak_modules} ]; then
369 echo %{module} | %{__weak_modules} --remove-modules
370fi
371%endif
372%endif
373
374
375## Post-Uninstall Script (Kernel Module)
376%if !%dkms
377%postun -n kmod-%{name}
378%{__depmod} %{kernel} -a
379%endif
380
381
382## File Catalog
383%ifnarch noarch
384%files
385%defattr(-, root, root)
386%{_sbindir}
387%{_mandir}/man?
388%{_initrddir}
389%config(noreplace) %{ietd_conf}
390%config(noreplace) %{initiators_allow}
391%config(noreplace) %{targets_allow}
392%doc %{_docdir}
393%endif
394
395
396## File Catalog (Kernel Module)
397%if %dkms
398%ifarch noarch
399%files -n dkms-%{name}
400%defattr(-, root, root)
401/usr/src/%{name}-%{version}
402%endif
403%else
404%files -n kmod-%{name}
405%defattr(-, root, root)
406/lib/modules/%{kernel}
407%endif
408
409
410%changelog
411* Tue May 11 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20.2
412- fixed recursive KERNELSRC define problem on SLES
413- updated SVN building to handle tagged builds
414- updated iet_version for next release
415- fixed install and file catalogs to work with previous versions
416
417* Tue Mar 30 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20
418- Changed DKMS module name to dkms-iscsitarget from kmod-iscsitarget
419- Added Provides: kernel-modules to DKMS module so multiple versions can
420 be managed by DKMS at once.
421- Added conflicts to dkms and kmod for each other so only one type can
422 be installed at a time.
423- Added --rpm_safe_upgrade to DKMS add/remove for RPM-DKMS sync
424- Added --force to DKMS install in case version changed, but code didn't
425
426* Mon Mar 29 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20
427- Updated SVN build defines.
428- Added weak build define to manually choose KABI tracking or per-kernel
429- Fixed issue with upgrading KABI tracking module by removing
430 Provides: kernel-modules to weak builds, kept for per-kernel builds
431 if you install weak built module, all per-kernels are uninstalled,
432 you cannot install a per-kernel while a weak built is installed.
433
434* Mon Mar 08 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.19
435- removed openssl-devel build requirement
436
437* Wed Oct 14 2009 Ross Walker <rswwalker at gmail dot com> - 1.4.18
438- Added more macros for better cross-distro support
439- Modified Matt's update for better Redhat-SuSE compatibility
440
441* Fri Oct 09 2009 Matthew Wild <matthew.wild at stfc dot ac dot uk> - 1.4.18
442- Added openSuSE specific configuration
443- Tidied up files section for init.d|rc.d
444- run depmod with -a rather than -A option
445
446* Wed Sep 25 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-244
447- SuSE puts weak-modules under /usr/lib/module-init-tools
448- Kernel module now located in /lib/modules/<kernel>/extra/iscsi
449
450* Wed Sep 25 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-242
451- Added ability to build weak modules for platforms that support them
452- Cleaned up logic a little
453- Made safe for multi-user builds
454- Redacted old spec file maintainer's email address
455
456* Wed Sep 22 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-236
457- Updated file catalog for new config directory
458
459* Wed Sep 09 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-226
460- Added ability to build directly from subversion repo
461- Added ability to build dkms kernel module
462
463* Mon Nov 10 2008 Ross Walker <rswwalker at gmail dot com> - 0.4.17-177
464- Changed kernel-module naming to kmod
465- Updated versioning
466
467* Fri Feb 16 2007 Ross Walker <rswwalker at gmail dot com> - 0.4.14-96
468- Reworked spec file for latest release
469- Commented and cleaned up sections
470- Added additional documents to %files
471
472* Mon Nov 21 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1266.1
473- upstream snapshot 1266
474- added condrestart patch
475- stop and start service on update or removal
476
477* Sun Nov 13 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1264.2
478- run %post and %preun for kernel package, not main package
479
480* Sun Nov 13 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1264.1
481- updated to snapshot 1264
482
483* Thu Nov 03 2005 Bastiaan Bakker <redacted> - 0.4.12-6
484- added openssl-devel build requirement
485- removed '.ko' extension in modprobe command
486
487* Wed Nov 02 2005 Bastiaan Bakker <redacted> - 0.4.12-5
488- fixed kernel-devel BuildRequires
489
490* Fri Sep 23 2005 Bastiaan Bakker <redacted> - 0.4.12-4
491- fixed modprobe -r 'FATAL' message
492- run depmod with correct kernel version
493
494* Fri Sep 23 2005 Bastiaan Bakker <redacted> - 0.4.12-3
495- added config files
496- set kernel module file permissions to 744
497- fixed provides/requires of kernel module
498- removed BuildArch restriction
499
500* Thu Sep 22 2005 Bastiaan Bakker <redacted> - 0.4.12-2
501- create separate subpackage for kernel module
502- include man pages
503- added kernel compatibility patch for kernels < 2.6.11
504
505* Wed Aug 03 2005 Bastiaan Bakker <redacted>
506- First version.
507
0508
=== added directory '.pc/debian-changes-1.4.20.2-5/kernel'
=== added file '.pc/debian-changes-1.4.20.2-5/kernel/block-io.c'
--- .pc/debian-changes-1.4.20.2-5/kernel/block-io.c 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/kernel/block-io.c 2011-06-29 14:00:59 +0000
@@ -0,0 +1,327 @@
1/*
2 * Target device block I/O.
3 *
4 * Based on file I/O driver from FUJITA Tomonori
5 * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
6 * (C) 2006 Andre Brinkmann <brinkman at hni dot upb dot de>
7 * (C) 2007 Ross Walker <rswwalker at hotmail dot com>
8 * (C) 2007 Ming Zhang <blackmagic02881 at gmail dot com>
9 * This code is licenced under the GPL.
10 */
11
12#include <linux/types.h>
13#include <linux/blkdev.h>
14#include <linux/parser.h>
15#include <linux/buffer_head.h>
16
17#include "iscsi.h"
18#include "iscsi_dbg.h"
19#include "iotype.h"
20
21struct blockio_data {
22 char *path;
23 struct block_device *bdev;
24};
25
26struct tio_work {
27 atomic_t error;
28 atomic_t bios_remaining;
29 struct completion tio_complete;
30};
31
32static void blockio_bio_endio(struct bio *bio, int error)
33{
34 struct tio_work *tio_work = bio->bi_private;
35
36 error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
37
38 if (error)
39 atomic_set(&tio_work->error, error);
40
41 /* If last bio signal completion */
42 if (atomic_dec_and_test(&tio_work->bios_remaining))
43 complete(&tio_work->tio_complete);
44
45 bio_put(bio);
46}
47
48/*
49 * Blockio_make_request(): The function translates an iscsi-request into
50 * a number of requests to the corresponding block device.
51 */
52static int
53blockio_make_request(struct iet_volume *volume, struct tio *tio, int rw)
54{
55 struct blockio_data *bio_data = volume->private;
56 struct request_queue *bdev_q = bdev_get_queue(bio_data->bdev);
57 struct tio_work *tio_work;
58 struct bio *tio_bio = NULL, *bio = NULL, *biotail = NULL;
59
60 u32 offset = tio->offset;
61 u32 size = tio->size;
62 u32 tio_index = 0;
63
64 int max_pages = 1;
65 int err = 0;
66
67 loff_t ppos = ((loff_t) tio->idx << PAGE_SHIFT) + offset;
68
69 /* Calculate max_pages for bio_alloc (memory saver) */
70 if (bdev_q)
71 max_pages = bio_get_nr_vecs(bio_data->bdev);
72
73 tio_work = kzalloc(sizeof (*tio_work), GFP_KERNEL);
74 if (!tio_work)
75 return -ENOMEM;
76
77 atomic_set(&tio_work->error, 0);
78 atomic_set(&tio_work->bios_remaining, 0);
79 init_completion(&tio_work->tio_complete);
80
81 /* Main processing loop, allocate and fill all bios */
82 while (tio_index < tio->pg_cnt) {
83 bio = bio_alloc(GFP_KERNEL, min(max_pages, BIO_MAX_PAGES));
84 if (!bio) {
85 err = -ENOMEM;
86 goto out;
87 }
88
89 /* bi_sector is ALWAYS in units of 512 bytes */
90 bio->bi_sector = ppos >> 9;
91 bio->bi_bdev = bio_data->bdev;
92 bio->bi_end_io = blockio_bio_endio;
93 bio->bi_private = tio_work;
94
95 if (tio_bio)
96 biotail = biotail->bi_next = bio;
97 else
98 tio_bio = biotail = bio;
99
100 atomic_inc(&tio_work->bios_remaining);
101
102 /* Loop for filling bio */
103 while (tio_index < tio->pg_cnt) {
104 unsigned int bytes = PAGE_SIZE - offset;
105
106 if (bytes > size)
107 bytes = size;
108
109 if (!bio_add_page(bio, tio->pvec[tio_index], bytes, offset))
110 break;
111
112 size -= bytes;
113 ppos += bytes;
114
115 offset = 0;
116
117 tio_index++;
118 }
119 }
120
121 /* Walk the list, submitting bios 1 by 1 */
122 while (tio_bio) {
123 bio = tio_bio;
124 tio_bio = tio_bio->bi_next;
125 bio->bi_next = NULL;
126
127 submit_bio(rw, bio);
128 }
129
130 if (bdev_q && bdev_q->unplug_fn)
131 bdev_q->unplug_fn(bdev_q);
132
133 wait_for_completion(&tio_work->tio_complete);
134
135 err = atomic_read(&tio_work->error);
136
137 kfree(tio_work);
138
139 return err;
140out:
141 while (tio_bio) {
142 bio = tio_bio;
143 tio_bio = tio_bio->bi_next;
144
145 bio_put(bio);
146 }
147
148 kfree(tio_work);
149
150 return err;
151}
152
153static int
154blockio_open_path(struct iet_volume *volume, const char *path)
155{
156 struct blockio_data *bio_data = volume->private;
157 struct block_device *bdev;
158 int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
159 int err = 0;
160
161 bio_data->path = kstrdup(path, GFP_KERNEL);
162 if (!bio_data->path)
163 return -ENOMEM;
164
165 bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
166 if (IS_ERR(bdev)) {
167 err = PTR_ERR(bdev);
168 eprintk("Can't open device %s, error %d\n", path, err);
169 bio_data->bdev = NULL;
170 } else {
171 bio_data->bdev = bdev;
172 fsync_bdev(bio_data->bdev);
173 }
174
175 return err;
176}
177
178/* Create an enumeration of our accepted actions */
179enum
180{
181 opt_path, opt_ignore, opt_err,
182};
183
184/* Create a match table using our action enums and their matching options */
185static match_table_t tokens = {
186 {opt_path, "path=%s"},
187 {opt_ignore, "scsiid=%s"},
188 {opt_ignore, "scsisn=%s"},
189 {opt_ignore, "type=%s"},
190 {opt_ignore, "iomode=%s"},
191 {opt_ignore, "blocksize=%s"},
192 {opt_err, NULL},
193};
194
195static int
196parse_blockio_params(struct iet_volume *volume, char *params)
197{
198 struct blockio_data *info = volume->private;
199 int err = 0;
200 char *p, *q;
201
202 /* Loop through parameters separated by commas, look up our
203 * parameter in match table, return enumeration and arguments
204 * select case based on the returned enum and run the action */
205 while ((p = strsep(&params, ",")) != NULL) {
206 substring_t args[MAX_OPT_ARGS];
207 int token;
208 if (!*p)
209 continue;
210 iet_strtolower(p);
211 token = match_token(p, tokens, args);
212 switch (token) {
213 case opt_path:
214 if (info->path) {
215 iprintk("Target %s, LUN %u: "
216 "duplicate \"Path\" param\n",
217 volume->target->name, volume->lun);
218 err = -EINVAL;
219 goto out;
220 }
221 if (!(q = match_strdup(&args[0]))) {
222 err = -ENOMEM;
223 goto out;
224 }
225 err = blockio_open_path(volume, q);
226 kfree(q);
227 if (err < 0)
228 goto out;
229 break;
230 case opt_ignore:
231 break;
232 default:
233 iprintk("Target %s, LUN %u: unknown param %s\n",
234 volume->target->name, volume->lun, p);
235 return -EINVAL;
236 }
237 }
238
239 if (!info->path) {
240 iprintk("Target %s, LUN %u: missing \"Path\" param\n",
241 volume->target->name, volume->lun);
242 err = -EINVAL;
243 }
244
245 out:
246 return err;
247}
248
249static void
250blockio_detach(struct iet_volume *volume)
251{
252 struct blockio_data *bio_data = volume->private;
253 int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
254
255 if (bio_data->bdev)
256 close_bdev_exclusive(bio_data->bdev, flags);
257 kfree(bio_data->path);
258
259 kfree(volume->private);
260}
261
262static int
263blockio_attach(struct iet_volume *volume, char *args)
264{
265 struct blockio_data *bio_data;
266 int err = 0;
267
268 if (volume->private) {
269 eprintk("Lun %u already attached on Target %s \n",
270 volume->lun, volume->target->name);
271 return -EBUSY;
272 }
273
274 bio_data = kzalloc(sizeof (*bio_data), GFP_KERNEL);
275 if (!bio_data)
276 return -ENOMEM;
277
278 volume->private = bio_data;
279
280 err = parse_blockio_params(volume, args);
281 if (!err) {
282 /* see Documentation/ABI/testing/sysfs-block */
283 unsigned bsz = bdev_logical_block_size(bio_data->bdev);
284 if (!volume->blk_shift)
285 volume->blk_shift = blksize_bits(bsz);
286 else if (volume->blk_shift < blksize_bits(bsz)) {
287 eprintk("Specified block size (%u) smaller than "
288 "device %s logical block size (%u)\n",
289 (1 << volume->blk_shift), bio_data->path, bsz);
290 err = -EINVAL;
291 }
292 }
293 if (err < 0) {
294 eprintk("Error attaching Lun %u to Target %s \n",
295 volume->lun, volume->target->name);
296 goto out;
297 }
298
299 volume->blk_cnt = bio_data->bdev->bd_inode->i_size >> volume->blk_shift;
300
301 /* Offer neither write nor read caching */
302 ClearLURCache(volume);
303 ClearLUWCache(volume);
304
305 out:
306 if (err < 0)
307 blockio_detach(volume);
308
309 return err;
310}
311
312static void
313blockio_show(struct iet_volume *volume, struct seq_file *seq)
314{
315 struct blockio_data *bio_data = volume->private;
316
317 /* Used to display blockio volume info in /proc/net/iet/volumes */
318 seq_printf(seq, " path:%s\n", bio_data->path);
319}
320
321struct iotype blockio = {
322 .name = "blockio",
323 .attach = blockio_attach,
324 .make_request = blockio_make_request,
325 .detach = blockio_detach,
326 .show = blockio_show,
327};
0328
=== added file '.pc/debian-changes-1.4.20.2-5/kernel/config.c'
--- .pc/debian-changes-1.4.20.2-5/kernel/config.c 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/kernel/config.c 2011-06-29 14:00:59 +0000
@@ -0,0 +1,362 @@
1/*
2 * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
3 *
4 * This code is licenced under the GPL.
5 */
6
7#include <linux/proc_fs.h>
8
9#include "iscsi.h"
10#include "iscsi_dbg.h"
11
12static DECLARE_MUTEX(ioctl_sem);
13
14struct proc_entries {
15 const char *name;
16 struct file_operations *fops;
17};
18
19static struct proc_entries iet_proc_entries[] =
20{
21 {"volume", &volume_seq_fops},
22 {"session", &session_seq_fops},
23};
24
25static struct proc_dir_entry *proc_iet_dir;
26
27void iet_procfs_exit(void)
28{
29 int i;
30
31 if (!proc_iet_dir)
32 return;
33
34 for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++)
35 remove_proc_entry(iet_proc_entries[i].name, proc_iet_dir);
36
37 remove_proc_entry(proc_iet_dir->name, proc_iet_dir->parent);
38}
39
40int iet_procfs_init(void)
41{
42 int i;
43 struct proc_dir_entry *ent;
44
45 if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
46 goto err;
47
48 for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++) {
49 ent = create_proc_entry(iet_proc_entries[i].name, 0, proc_iet_dir);
50 if (ent)
51 ent->proc_fops = iet_proc_entries[i].fops;
52 else
53 goto err;
54 }
55
56 return 0;
57
58err:
59 if (proc_iet_dir)
60 iet_procfs_exit();
61
62 return -ENOMEM;
63}
64
65static int get_module_info(unsigned long ptr)
66{
67 struct module_info info;
68 int err;
69
70 snprintf(info.version, sizeof(info.version), "%s", IET_VERSION_STRING);
71
72 err = copy_to_user((void *) ptr, &info, sizeof(info));
73 if (err)
74 return -EFAULT;
75
76 return 0;
77}
78
79static int get_conn_info(struct iscsi_target *target, unsigned long ptr)
80{
81 struct iscsi_session *session;
82 struct iscsi_conn *conn;
83 struct conn_info info;
84 int err;
85
86 err = copy_from_user(&info, (void *) ptr, sizeof(info));
87 if (err)
88 return -EFAULT;
89
90 session = session_lookup(target, info.sid);
91 if (!session)
92 return -ENOENT;
93
94 conn = conn_lookup(session, info.cid);
95 if (!conn)
96 return -ENOENT;
97
98 info.cid = conn->cid;
99 info.stat_sn = conn->stat_sn;
100 info.exp_stat_sn = conn->exp_stat_sn;
101
102 err = copy_to_user((void *) ptr, &info, sizeof(info));
103 if (err)
104 return -EFAULT;
105
106 return 0;
107}
108
109static int add_conn(struct iscsi_target *target, unsigned long ptr)
110{
111 struct iscsi_session *session;
112 struct conn_info info;
113 int err;
114
115 err = copy_from_user(&info, (void *) ptr, sizeof(info));
116 if (err)
117 return -EFAULT;
118
119 session = session_lookup(target, info.sid);
120 if (!session)
121 return -ENOENT;
122
123 return conn_add(session, &info);
124}
125
126static int del_conn(struct iscsi_target *target, unsigned long ptr)
127{
128 struct iscsi_session *session;
129 struct conn_info info;
130 int err;
131
132 err = copy_from_user(&info, (void *) ptr, sizeof(info));
133 if (err)
134 return -EFAULT;
135
136 session = session_lookup(target, info.sid);
137 if (!session)
138 return -ENOENT;
139
140 return conn_del(session, &info);
141}
142
143static int get_session_info(struct iscsi_target *target, unsigned long ptr)
144{
145 struct iscsi_session *session;
146 struct session_info info;
147 int err;
148
149 err = copy_from_user(&info, (void *) ptr, sizeof(info));
150 if (err)
151 return -EFAULT;
152
153 session = session_lookup(target, info.sid);
154 if (!session)
155 return -ENOENT;
156
157 info.exp_cmd_sn = session->exp_cmd_sn;
158 info.max_cmd_sn = session->max_cmd_sn;
159
160 err = copy_to_user((void *) ptr, &info, sizeof(info));
161 if (err)
162 return -EFAULT;
163
164 return 0;
165}
166
167static int add_session(struct iscsi_target *target, unsigned long ptr)
168{
169 struct session_info info;
170 int err;
171
172 err = copy_from_user(&info, (void *) ptr, sizeof(info));
173 if (err)
174 return -EFAULT;
175
176 return session_add(target, &info);
177}
178
179static int del_session(struct iscsi_target *target, unsigned long ptr)
180{
181 struct session_info info;
182 int err;
183
184 err = copy_from_user(&info, (void *) ptr, sizeof(info));
185 if (err)
186 return -EFAULT;
187
188 return session_del(target, info.sid);
189}
190
191static int add_volume(struct iscsi_target *target, unsigned long ptr)
192{
193 struct volume_info info;
194 int err;
195
196 err = copy_from_user(&info, (void *) ptr, sizeof(info));
197 if (err)
198 return -EFAULT;
199
200 return volume_add(target, &info);
201}
202
203static int del_volume(struct iscsi_target *target, unsigned long ptr)
204{
205 struct volume_info info;
206 int err;
207
208 err = copy_from_user(&info, (void *) ptr, sizeof(info));
209 if (err)
210 return -EFAULT;
211
212 return iscsi_volume_del(target, &info);
213}
214
215static int iscsi_param_config(struct iscsi_target *target, unsigned long ptr, int set)
216{
217 struct iscsi_param_info info;
218 int err;
219
220 err = copy_from_user(&info, (void *) ptr, sizeof(info));
221 if (err)
222 return -EFAULT;
223
224 err = iscsi_param_set(target, &info, set);
225 if (err < 0 || set)
226 return err;
227
228 err = copy_to_user((void *) ptr, &info, sizeof(info));
229 if (err)
230 return -EFAULT;
231
232 return 0;
233}
234
235static int add_target(unsigned long ptr)
236{
237 struct target_info info;
238 int err;
239
240 err = copy_from_user(&info, (void *) ptr, sizeof(info));
241 if (err)
242 return -EFAULT;
243
244 err = target_add(&info);
245 if (err < 0)
246 return err;
247
248 err = copy_to_user((void *) ptr, &info, sizeof(info));
249 if (err)
250 return -EFAULT;
251
252 return 0;
253}
254
255static long ioctl(struct file *file, unsigned int cmd, unsigned long arg)
256{
257 struct iscsi_target *target = NULL;
258 long err;
259 u32 id;
260
261 err = down_interruptible(&ioctl_sem);
262 if (err < 0)
263 return err;
264
265 if (cmd == GET_MODULE_INFO) {
266 err = get_module_info(arg);
267 goto done;
268 }
269
270 if (cmd == ADD_TARGET) {
271 err = add_target(arg);
272 goto done;
273 }
274
275 err = get_user(id, (u32 *) arg);
276 if (err < 0)
277 goto done;
278
279 /* locking handled in target_del */
280 if (cmd == DEL_TARGET) {
281 err = target_del(id);
282 goto done;
283 }
284
285 target = target_lookup_by_id(id);
286 if (!target) {
287 err = -ENOENT;
288 goto done;
289 }
290
291 err = target_lock(target, 1);
292 if (err < 0)
293 goto done;
294
295 switch (cmd) {
296 case ADD_VOLUME:
297 err = add_volume(target, arg);
298 break;
299
300 case DEL_VOLUME:
301 err = del_volume(target, arg);
302 break;
303
304 case ADD_SESSION:
305 err = add_session(target, arg);
306 break;
307
308 case DEL_SESSION:
309 err = del_session(target, arg);
310 break;
311
312 case GET_SESSION_INFO:
313 err = get_session_info(target, arg);
314 break;
315
316 case ISCSI_PARAM_SET:
317 err = iscsi_param_config(target, arg, 1);
318 break;
319
320 case ISCSI_PARAM_GET:
321 err = iscsi_param_config(target, arg, 0);
322 break;
323
324 case ADD_CONN:
325 err = add_conn(target, arg);
326 break;
327
328 case DEL_CONN:
329 err = del_conn(target, arg);
330 break;
331
332 case GET_CONN_INFO:
333 err = get_conn_info(target, arg);
334 break;
335 default:
336 eprintk("invalid ioctl cmd %x\n", cmd);
337 err = -EINVAL;
338 }
339
340 target_unlock(target);
341done:
342 up(&ioctl_sem);
343
344 return err;
345}
346
347static int release(struct inode *i __attribute__((unused)),
348 struct file *f __attribute__((unused)))
349{
350 down(&ioctl_sem);
351 target_del_all();
352 up(&ioctl_sem);
353
354 return 0;
355}
356
357struct file_operations ctr_fops = {
358 .owner = THIS_MODULE,
359 .unlocked_ioctl = ioctl,
360 .compat_ioctl = ioctl,
361 .release = release
362};
0363
=== added file '.pc/debian-changes-1.4.20.2-5/kernel/conn.c'
--- .pc/debian-changes-1.4.20.2-5/kernel/conn.c 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/kernel/conn.c 2011-06-29 14:00:59 +0000
@@ -0,0 +1,262 @@
1/*
2 * Copyright (C) 2002-2003 Ardis Technolgies <roman@ardistech.com>
3 *
4 * Released under the terms of the GNU GPL v2.0.
5 */
6
7#include <linux/file.h>
8#include <linux/ip.h>
9#include <net/tcp.h>
10#include <scsi/scsi.h>
11
12#include "iscsi.h"
13#include "iscsi_dbg.h"
14#include "digest.h"
15
16static void print_conn_state(char *p, size_t size, unsigned long state)
17{
18 if (test_bit(CONN_ACTIVE, &state))
19 snprintf(p, size, "%s", "active");
20 else if (test_bit(CONN_CLOSING, &state))
21 snprintf(p, size, "%s", "closing");
22 else
23 snprintf(p, size, "%s", "unknown");
24}
25
26static void print_digest_state(char *p, size_t size, unsigned long flags)
27{
28 if (DIGEST_NONE & flags)
29 snprintf(p, size, "%s", "none");
30 else if (DIGEST_CRC32C & flags)
31 snprintf(p, size, "%s", "crc32c");
32 else
33 snprintf(p, size, "%s", "unknown");
34}
35
36void conn_info_show(struct seq_file *seq, struct iscsi_session *session)
37{
38 struct iscsi_conn *conn;
39 struct sock *sk;
40 char buf[64];
41
42 list_for_each_entry(conn, &session->conn_list, list) {
43 sk = conn->sock->sk;
44 switch (sk->sk_family) {
45 case AF_INET:
46 snprintf(buf, sizeof(buf),
47 "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->inet_daddr));
48 break;
49 case AF_INET6:
50 snprintf(buf, sizeof(buf), "[%pI6]",
51 &inet6_sk(sk)->daddr);
52 break;
53 default:
54 break;
55 }
56 seq_printf(seq, "\t\tcid:%u ip:%s ", conn->cid, buf);
57 print_conn_state(buf, sizeof(buf), conn->state);
58 seq_printf(seq, "state:%s ", buf);
59 print_digest_state(buf, sizeof(buf), conn->hdigest_type);
60 seq_printf(seq, "hd:%s ", buf);
61 print_digest_state(buf, sizeof(buf), conn->ddigest_type);
62 seq_printf(seq, "dd:%s\n", buf);
63 }
64}
65
66struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid)
67{
68 struct iscsi_conn *conn;
69
70 list_for_each_entry(conn, &session->conn_list, list) {
71 if (conn->cid == cid)
72 return conn;
73 }
74 return NULL;
75}
76
77static void iet_state_change(struct sock *sk)
78{
79 struct iscsi_conn *conn = sk->sk_user_data;
80 struct iscsi_target *target = conn->session->target;
81
82 if (sk->sk_state != TCP_ESTABLISHED)
83 conn_close(conn);
84 else
85 nthread_wakeup(target);
86
87 target->nthread_info.old_state_change(sk);
88}
89
90static void iet_data_ready(struct sock *sk, int len)
91{
92 struct iscsi_conn *conn = sk->sk_user_data;
93 struct iscsi_target *target = conn->session->target;
94
95 nthread_wakeup(target);
96 target->nthread_info.old_data_ready(sk, len);
97}
98
99/*
100 * @locking: grabs the target's nthread_lock to protect it from races with
101 * set_conn_wspace_wait()
102 */
103static void iet_write_space(struct sock *sk)
104{
105 struct iscsi_conn *conn = sk->sk_user_data;
106 struct network_thread_info *info = &conn->session->target->nthread_info;
107
108 spin_lock_bh(&info->nthread_lock);
109
110 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) &&
111 test_bit(CONN_WSPACE_WAIT, &conn->state)) {
112 clear_bit(CONN_WSPACE_WAIT, &conn->state);
113 __nthread_wakeup(info);
114 }
115
116 spin_unlock_bh(&info->nthread_lock);
117
118 info->old_write_space(sk);
119}
120
121static void iet_socket_bind(struct iscsi_conn *conn)
122{
123 int opt = 1;
124 mm_segment_t oldfs;
125 struct iscsi_session *session = conn->session;
126 struct iscsi_target *target = session->target;
127
128 dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid);
129
130 conn->sock = SOCKET_I(conn->file->f_dentry->d_inode);
131 conn->sock->sk->sk_user_data = conn;
132
133 write_lock_bh(&conn->sock->sk->sk_callback_lock);
134 target->nthread_info.old_state_change = conn->sock->sk->sk_state_change;
135 conn->sock->sk->sk_state_change = iet_state_change;
136
137 target->nthread_info.old_data_ready = conn->sock->sk->sk_data_ready;
138 conn->sock->sk->sk_data_ready = iet_data_ready;
139
140 target->nthread_info.old_write_space = conn->sock->sk->sk_write_space;
141 conn->sock->sk->sk_write_space = iet_write_space;
142 write_unlock_bh(&conn->sock->sk->sk_callback_lock);
143
144 oldfs = get_fs();
145 set_fs(get_ds());
146 conn->sock->ops->setsockopt(conn->sock, SOL_TCP, TCP_NODELAY, (void *)&opt, sizeof(opt));
147 set_fs(oldfs);
148}
149
150int conn_free(struct iscsi_conn *conn)
151{
152 dprintk(D_GENERIC, "%p %#Lx %u\n", conn->session,
153 (unsigned long long) conn->session->sid, conn->cid);
154
155 assert(atomic_read(&conn->nr_cmnds) == 0);
156 assert(list_empty(&conn->pdu_list));
157 assert(list_empty(&conn->write_list));
158
159 list_del(&conn->list);
160 list_del(&conn->poll_list);
161
162 del_timer_sync(&conn->nop_timer);
163 digest_cleanup(conn);
164 kfree(conn);
165
166 return 0;
167}
168
169static int iet_conn_alloc(struct iscsi_session *session, struct conn_info *info)
170{
171 struct iscsi_conn *conn;
172
173 dprintk(D_SETUP, "%#Lx:%u\n", (unsigned long long) session->sid, info->cid);
174
175 conn = kzalloc(sizeof(*conn), GFP_KERNEL);
176 if (!conn)
177 return -ENOMEM;
178
179 conn->session = session;
180 conn->cid = info->cid;
181 conn->stat_sn = info->stat_sn;
182 conn->exp_stat_sn = info->exp_stat_sn;
183
184 conn->hdigest_type = info->header_digest;
185 conn->ddigest_type = info->data_digest;
186 if (digest_init(conn) < 0) {
187 kfree(conn);
188 return -ENOMEM;
189 }
190
191 spin_lock_init(&conn->list_lock);
192 atomic_set(&conn->nr_cmnds, 0);
193 atomic_set(&conn->nr_busy_cmnds, 0);
194 INIT_LIST_HEAD(&conn->pdu_list);
195 INIT_LIST_HEAD(&conn->write_list);
196 INIT_LIST_HEAD(&conn->poll_list);
197 init_timer(&conn->nop_timer);
198
199 list_add(&conn->list, &session->conn_list);
200
201 set_bit(CONN_ACTIVE, &conn->state);
202
203 conn->file = fget(info->fd);
204 iet_socket_bind(conn);
205
206 list_add(&conn->poll_list, &session->target->nthread_info.active_conns);
207
208 nthread_wakeup(conn->session->target);
209
210 return 0;
211}
212
213void conn_close(struct iscsi_conn *conn)
214{
215 struct iscsi_cmnd *cmnd;
216 struct iscsi_session *session = conn->session;
217
218 if (test_and_clear_bit(CONN_ACTIVE, &conn->state))
219 set_bit(CONN_CLOSING, &conn->state);
220
221 spin_lock(&conn->list_lock);
222 list_for_each_entry(cmnd, &conn->pdu_list, conn_list) {
223 set_cmnd_tmfabort(cmnd);
224 if (cmnd->lun) {
225 ua_establish_for_session(session, cmnd->lun->lun, 0x47, 0x7f);
226 iscsi_cmnd_set_sense(cmnd, UNIT_ATTENTION, 0x6e, 0x0);
227 }
228 }
229 spin_unlock(&conn->list_lock);
230
231 nthread_wakeup(conn->session->target);
232}
233
234int conn_add(struct iscsi_session *session, struct conn_info *info)
235{
236 struct iscsi_conn *conn;
237 int err;
238
239 conn = conn_lookup(session, info->cid);
240 if (conn)
241 conn_close(conn);
242
243 err = iet_conn_alloc(session, info);
244 if (!err && conn)
245 err = -EEXIST;
246
247 return err;
248}
249
250int conn_del(struct iscsi_session *session, struct conn_info *info)
251{
252 struct iscsi_conn *conn;
253 int err = -EEXIST;
254
255 conn = conn_lookup(session, info->cid);
256 if (!conn)
257 return err;
258
259 conn_close(conn);
260
261 return 0;
262}
0263
=== added file '.pc/debian-changes-1.4.20.2-5/kernel/iotype.c'
--- .pc/debian-changes-1.4.20.2-5/kernel/iotype.c 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/kernel/iotype.c 2011-06-29 14:00:59 +0000
@@ -0,0 +1,110 @@
1/*
2 * Manager for various I/O types.
3 * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
4 * This code is licenced under the GPL.
5 */
6
7#include "iscsi.h"
8#include "iotype.h"
9#include "iscsi_dbg.h"
10
11static LIST_HEAD(iotypes);
12static rwlock_t iotypes_lock = RW_LOCK_UNLOCKED;
13
14static struct iotype *find_iotype(const char *name)
15{
16 struct iotype *iot = NULL;
17
18 list_for_each_entry(iot, &iotypes, iot_list) {
19 if (strcmp(iot->name, name) == 0)
20 return iot;
21 }
22 return NULL;
23}
24
25struct iotype *get_iotype(const char *name)
26{
27 struct iotype *iot;
28
29 read_lock(&iotypes_lock);
30 iot = find_iotype(name);
31 read_unlock(&iotypes_lock);
32
33 return iot;
34}
35
36void put_iotype(struct iotype *iot)
37{
38 if (!iot)
39 return;
40 return;
41}
42
43static int register_iotype(struct iotype *iot)
44{
45 int err = 0;
46 struct iotype *p;
47
48 write_lock(&iotypes_lock);
49
50 p = find_iotype(iot->name);
51 if (p)
52 err = -EBUSY;
53 else
54 list_add_tail(&iot->iot_list, &iotypes);
55
56 write_unlock(&iotypes_lock);
57
58 return err;
59}
60
61static int unregister_iotype(struct iotype *iot)
62{
63 int err = 0;
64 struct iotype *p;
65
66 write_lock(&iotypes_lock);
67
68 p = find_iotype(iot->name);
69 if (p && p == iot)
70 list_del_init(&iot->iot_list);
71 else
72 err = -EINVAL;
73
74 write_unlock(&iotypes_lock);
75
76
77 return err;
78}
79
80struct iotype *iotype_array[] = {
81 &fileio,
82 &blockio,
83 &nullio,
84};
85
86int iotype_init(void)
87{
88 int i, err;
89
90 for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
91 if (!(err = register_iotype(iotype_array[i])))
92 iprintk("Registered io type %s\n",
93 iotype_array[i]->name);
94 else {
95 eprintk("Failed to register io type %s\n",
96 iotype_array[i]->name);
97 break;
98 }
99 }
100
101 return err;
102}
103
104void iotype_exit(void)
105{
106 int i;
107
108 for (i = 0; i < ARRAY_SIZE(iotype_array); i++)
109 unregister_iotype(iotype_array[i]);
110}
0111
=== added file '.pc/debian-changes-1.4.20.2-5/kernel/iscsi.c'
--- .pc/debian-changes-1.4.20.2-5/kernel/iscsi.c 1970-01-01 00:00:00 +0000
+++ .pc/debian-changes-1.4.20.2-5/kernel/iscsi.c 2011-06-29 14:00:59 +0000
@@ -0,0 +1,1967 @@
1/*
2 * Copyright (C) 2002-2003 Ardis Technolgies <roman@ardistech.com>
3 * Copyright (C) 2008 Arne Redlich <agr@powerkom-dd.de>
4 *
5 * Released under the terms of the GNU GPL v2.0.
6 */
7
8#include <linux/module.h>
9#include <linux/hash.h>
10#include <net/tcp.h>
11#include <scsi/scsi.h>
12
13#include "iscsi.h"
14#include "iscsi_dbg.h"
15#include "iotype.h"
16
17unsigned long debug_enable_flags;
18unsigned long worker_thread_pool_size;
19
20static struct kmem_cache *iscsi_cmnd_cache;
21static u8 dummy_data[PAGE_SIZE];
22
23static int ctr_major;
24static char ctr_name[] = "ietctl";
25extern struct file_operations ctr_fops;
26
27static u32 cmnd_write_size(struct iscsi_cmnd *cmnd)
28{
29 struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
30
31 if (hdr->flags & ISCSI_CMD_WRITE)
32 return be32_to_cpu(hdr->data_length);
33 return 0;
34}
35
36static u32 cmnd_read_size(struct iscsi_cmnd *cmnd)
37{
38 struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
39
40 if (hdr->flags & ISCSI_CMD_READ) {
41 struct iscsi_rlength_ahdr *ahdr =
42 (struct iscsi_rlength_ahdr *)cmnd->pdu.ahs;
43
44 if (!(hdr->flags & ISCSI_CMD_WRITE))
45 return be32_to_cpu(hdr->data_length);
46 if (ahdr && ahdr->ahstype == ISCSI_AHSTYPE_RLENGTH)
47 return be32_to_cpu(ahdr->read_length);
48 }
49 return 0;
50}
51
52static void iscsi_device_queue_cmnd(struct iscsi_cmnd *cmnd)
53{
54 set_cmnd_waitio(cmnd);
55 wthread_queue(cmnd);
56}
57
58static void iscsi_scsi_queuecmnd(struct iscsi_cmnd *cmnd)
59{
60 struct iscsi_queue *queue = &cmnd->lun->queue;
61
62 dprintk(D_GENERIC, "%p\n", cmnd);
63
64 if ((cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) != ISCSI_CMD_UNTAGGED &&
65 (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) != ISCSI_CMD_SIMPLE) {
66 cmnd->pdu.bhs.flags &= ~ISCSI_CMD_ATTR_MASK;
67 cmnd->pdu.bhs.flags |= ISCSI_CMD_UNTAGGED;
68 }
69
70 spin_lock(&queue->queue_lock);
71
72 set_cmnd_queued(cmnd);
73
74 switch (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) {
75 case ISCSI_CMD_UNTAGGED:
76 case ISCSI_CMD_SIMPLE:
77 if (!list_empty(&queue->wait_list) || queue->ordered_cmnd)
78 goto pending;
79 queue->active_cnt++;
80 break;
81
82 default:
83 BUG();
84 }
85 spin_unlock(&queue->queue_lock);
86
87 iscsi_device_queue_cmnd(cmnd);
88 return;
89 pending:
90 assert(list_empty(&cmnd->list));
91
92 list_add_tail(&cmnd->list, &queue->wait_list);
93 spin_unlock(&queue->queue_lock);
94 return;
95}
96
97static void iscsi_scsi_dequeuecmnd(struct iscsi_cmnd *cmnd)
98{
99 struct iscsi_queue *queue;
100
101 if (!cmnd->lun)
102 return;
103 queue = &cmnd->lun->queue;
104 spin_lock(&queue->queue_lock);
105 switch (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) {
106 case ISCSI_CMD_UNTAGGED:
107 case ISCSI_CMD_SIMPLE:
108 --queue->active_cnt;
109 break;
110 case ISCSI_CMD_ORDERED:
111 case ISCSI_CMD_HEAD_OF_QUEUE:
112 case ISCSI_CMD_ACA:
113 BUG();
114 default:
115 /* Should the iscsi_scsi_queuecmnd func reject this ? */
116 break;
117 }
118
119 while (!list_empty(&queue->wait_list)) {
120 cmnd = list_entry(queue->wait_list.next, struct iscsi_cmnd, list);
121 switch ((cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK)) {
122 case ISCSI_CMD_UNTAGGED:
123 case ISCSI_CMD_SIMPLE:
124 list_del_init(&cmnd->list);
125 queue->active_cnt++;
126 iscsi_device_queue_cmnd(cmnd);
127 break;
128 case ISCSI_CMD_ORDERED:
129 case ISCSI_CMD_HEAD_OF_QUEUE:
130 case ISCSI_CMD_ACA:
131 BUG();
132 }
133 }
134
135 spin_unlock(&queue->queue_lock);
136
137 return;
138}
139
140/**
141 * create a new command.
142 *
143 * iscsi_cmnd_create -
144 * @conn: ptr to connection (for i/o)
145 *
146 * @return ptr to command or NULL
147 */
148
149struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn, int req)
150{
151 struct iscsi_cmnd *cmnd;
152
153 /* TODO: async interface is necessary ? */
154 cmnd = kmem_cache_alloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
155
156 memset(cmnd, 0, sizeof(*cmnd));
157 INIT_LIST_HEAD(&cmnd->list);
158 INIT_LIST_HEAD(&cmnd->pdu_list);
159 INIT_LIST_HEAD(&cmnd->conn_list);
160 INIT_LIST_HEAD(&cmnd->hash_list);
161 cmnd->conn = conn;
162 spin_lock(&conn->list_lock);
163 atomic_inc(&conn->nr_cmnds);
164 if (req)
165 list_add_tail(&cmnd->conn_list, &conn->pdu_list);
166 spin_unlock(&conn->list_lock);
167 cmnd->tio = NULL;
168
169 dprintk(D_GENERIC, "%p:%p\n", conn, cmnd);
170
171 return cmnd;
172}
173
174/**
175 * create a new command used as response.
176 *
177 * iscsi_cmnd_create_rsp_cmnd -
178 * @cmnd: ptr to request command
179 *
180 * @return ptr to response command or NULL
181 */
182
183static struct iscsi_cmnd *iscsi_cmnd_create_rsp_cmnd(struct iscsi_cmnd *cmnd, int final)
184{
185 struct iscsi_cmnd *rsp = cmnd_alloc(cmnd->conn, 0);
186
187 if (final)
188 set_cmnd_final(rsp);
189 list_add_tail(&rsp->pdu_list, &cmnd->pdu_list);
190 rsp->req = cmnd;
191 return rsp;
192}
193
194static struct iscsi_cmnd *get_rsp_cmnd(struct iscsi_cmnd *req)
195{
196 return list_entry(req->pdu_list.prev, struct iscsi_cmnd, pdu_list);
197}
198
199static void iscsi_cmnds_init_write(struct list_head *send)
200{
201 struct iscsi_cmnd *cmnd = list_entry(send->next, struct iscsi_cmnd, list);
202 struct iscsi_conn *conn = cmnd->conn;
203 struct list_head *pos, *next;
204
205 spin_lock(&conn->list_lock);
206
207 list_for_each_safe(pos, next, send) {
208 cmnd = list_entry(pos, struct iscsi_cmnd, list);
209
210 dprintk(D_GENERIC, "%p:%x\n", cmnd, cmnd_opcode(cmnd));
211
212 list_del_init(&cmnd->list);
213 assert(conn == cmnd->conn);
214 list_add_tail(&cmnd->list, &conn->write_list);
215 }
216
217 spin_unlock(&conn->list_lock);
218
219 nthread_wakeup(conn->session->target);
220}
221
222static void iscsi_cmnd_init_write(struct iscsi_cmnd *cmnd)
223{
224 LIST_HEAD(head);
225
226 if (!list_empty(&cmnd->list)) {
227 eprintk("%x %x %x %x %lx %u %u %u %u %u %u %u %d %d\n",
228 cmnd_itt(cmnd), cmnd_ttt(cmnd), cmnd_opcode(cmnd),
229 cmnd_scsicode(cmnd), cmnd->flags, cmnd->r2t_sn,
230 cmnd->r2t_length, cmnd->is_unsolicited_data,
231 cmnd->target_task_tag, cmnd->outstanding_r2t,
232 cmnd->hdigest, cmnd->ddigest,
233 list_empty(&cmnd->pdu_list), list_empty(&cmnd->hash_list));
234
235 assert(list_empty(&cmnd->list));
236 }
237 list_add(&cmnd->list, &head);
238 iscsi_cmnds_init_write(&head);
239}
240
241static void do_send_data_rsp(struct iscsi_cmnd *cmnd)
242{
243 struct iscsi_conn *conn = cmnd->conn;
244 struct iscsi_cmnd *data_cmnd;
245 struct tio *tio = cmnd->tio;
246 struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd);
247 struct iscsi_data_in_hdr *rsp;
248 u32 pdusize, expsize, scsisize, size, offset, sn;
249 LIST_HEAD(send);
250
251 dprintk(D_GENERIC, "%p\n", cmnd);
252 pdusize = conn->session->param.max_xmit_data_length;
253 expsize = cmnd_read_size(cmnd);
254 size = min(expsize, tio->size);
255 offset = 0;
256 sn = 0;
257
258 while (1) {
259 data_cmnd = iscsi_cmnd_create_rsp_cmnd(cmnd, size <= pdusize);
260 tio_get(tio);
261 data_cmnd->tio = tio;
262 rsp = (struct iscsi_data_in_hdr *)&data_cmnd->pdu.bhs;
263
264 rsp->opcode = ISCSI_OP_SCSI_DATA_IN;
265 rsp->itt = req->itt;
266 rsp->ttt = cpu_to_be32(ISCSI_RESERVED_TAG);
267 rsp->buffer_offset = offset;
268 rsp->data_sn = cpu_to_be32(sn);
269
270 if (size <= pdusize) {
271 data_cmnd->pdu.datasize = size;
272 rsp->flags = ISCSI_FLG_FINAL | ISCSI_FLG_STATUS;
273
274 scsisize = tio->size;
275 if (scsisize < expsize) {
276 rsp->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
277 size = expsize - scsisize;
278 } else if (scsisize > expsize) {
279 rsp->flags |= ISCSI_FLG_RESIDUAL_OVERFLOW;
280 size = scsisize - expsize;
281 } else
282 size = 0;
283 rsp->residual_count = cpu_to_be32(size);
284 list_add_tail(&data_cmnd->list, &send);
285
286 break;
287 }
288
289 data_cmnd->pdu.datasize = pdusize;
290
291 size -= pdusize;
292 offset += pdusize;
293 sn++;
294
295 list_add_tail(&data_cmnd->list, &send);
296 }
297
298 iscsi_cmnds_init_write(&send);
299}
300
301static struct iscsi_cmnd *create_scsi_rsp(struct iscsi_cmnd *req)
302{
303 struct iscsi_cmnd *rsp;
304 struct iscsi_scsi_cmd_hdr *req_hdr = cmnd_hdr(req);
305 struct iscsi_scsi_rsp_hdr *rsp_hdr;
306 struct iscsi_sense_data *sense;
307
308 rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
309
310 rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs;
311 rsp_hdr->opcode = ISCSI_OP_SCSI_RSP;
312 rsp_hdr->flags = ISCSI_FLG_FINAL;
313 rsp_hdr->response = ISCSI_RESPONSE_COMMAND_COMPLETED;
314 rsp_hdr->cmd_status = req->status;
315 rsp_hdr->itt = req_hdr->itt;
316
317 if (req->status == SAM_STAT_CHECK_CONDITION) {
318 assert(!rsp->tio);
319 rsp->tio = tio_alloc(1);
320 sense = (struct iscsi_sense_data *)
321 page_address(rsp->tio->pvec[0]);
322
323 assert(sense);
324 clear_page(sense);
325 sense->length = cpu_to_be16(IET_SENSE_BUF_SIZE);
326
327 memcpy(sense->data, req->sense_buf, IET_SENSE_BUF_SIZE);
328 rsp->pdu.datasize = sizeof(struct iscsi_sense_data) +
329 IET_SENSE_BUF_SIZE;
330
331 rsp->tio->size = (rsp->pdu.datasize + 3) & -4;
332 rsp->tio->offset = 0;
333 }
334
335 return rsp;
336}
337
338void iscsi_cmnd_set_sense(struct iscsi_cmnd *cmnd, u8 sense_key, u8 asc,
339 u8 ascq)
340{
341 cmnd->status = SAM_STAT_CHECK_CONDITION;
342
343 cmnd->sense_buf[0] = 0xf0;
344 cmnd->sense_buf[2] = sense_key;
345 cmnd->sense_buf[7] = 6; // Additional sense length
346 cmnd->sense_buf[12] = asc;
347 cmnd->sense_buf[13] = ascq;
348
349 /* Call to ACA/UAI handler */
350}
351
352static struct iscsi_cmnd *create_sense_rsp(struct iscsi_cmnd *req,
353 u8 sense_key, u8 asc, u8 ascq)
354{
355 iscsi_cmnd_set_sense(req, sense_key, asc, ascq);
356 return create_scsi_rsp(req);
357}
358
359void send_scsi_rsp(struct iscsi_cmnd *req, void (*func)(struct iscsi_cmnd *))
360{
361 struct iscsi_cmnd *rsp;
362 struct iscsi_scsi_rsp_hdr *rsp_hdr;
363 u32 size;
364
365 func(req);
366 rsp = create_scsi_rsp(req);
367
368 switch (req->status) {
369 case SAM_STAT_GOOD:
370 case SAM_STAT_RESERVATION_CONFLICT:
371 rsp_hdr = (struct iscsi_scsi_rsp_hdr *) &rsp->pdu.bhs;
372 if ((size = cmnd_read_size(req)) != 0) {
373 rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
374 rsp_hdr->residual_count = cpu_to_be32(size);
375 }
376 break;
377 default:
378 break;
379 }
380
381 iscsi_cmnd_init_write(rsp);
382}
383
384void send_data_rsp(struct iscsi_cmnd *req, void (*func)(struct iscsi_cmnd *))
385{
386 struct iscsi_cmnd *rsp;
387
388 func(req);
389
390 if (req->status == SAM_STAT_GOOD)
391 do_send_data_rsp(req);
392 else {
393 rsp = create_scsi_rsp(req);
394 iscsi_cmnd_init_write(rsp);
395 }
396}
397
398/**
399 * Free a command.
400 * Also frees the additional header.
401 *
402 * iscsi_cmnd_remove -
403 * @cmnd: ptr to command
404 */
405
406static void iscsi_cmnd_remove(struct iscsi_cmnd *cmnd)
407{
408 struct iscsi_conn *conn;
409
410 if (!cmnd)
411 return;
412
413 if (cmnd_timer_active(cmnd)) {
414 clear_cmnd_timer_active(cmnd);
415 del_timer_sync(&cmnd->timer);
416 }
417
418 dprintk(D_GENERIC, "%p\n", cmnd);
419 conn = cmnd->conn;
420 kfree(cmnd->pdu.ahs);
421
422 if (!list_empty(&cmnd->list)) {
423 struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd);
424
425 eprintk("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x %lx\n",
426 cmnd, req->opcode, req->scb[0], req->flags, req->itt,
427 be32_to_cpu(req->data_length),
428 req->cmd_sn, be32_to_cpu(cmnd->pdu.datasize),
429 conn->state);
430
431 if (cmnd->req) {
432 struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd->req);
433 eprintk("%p %x %u\n", req, req->opcode, req->scb[0]);
434 }
435 dump_stack();
436 BUG();
437 }
438 list_del(&cmnd->list);
439 spin_lock(&conn->list_lock);
440 atomic_dec(&conn->nr_cmnds);
441 list_del(&cmnd->conn_list);
442 spin_unlock(&conn->list_lock);
443
444 if (cmnd->tio)
445 tio_put(cmnd->tio);
446
447 kmem_cache_free(iscsi_cmnd_cache, cmnd);
448}
449
450static void cmnd_skip_pdu(struct iscsi_cmnd *cmnd)
451{
452 struct iscsi_conn *conn = cmnd->conn;
453 struct tio *tio = cmnd->tio;
454 char *addr;
455 u32 size;
456 int i;
457
458 eprintk("%x %x %x %u\n", cmnd_itt(cmnd), cmnd_opcode(cmnd),
459 cmnd_hdr(cmnd)->scb[0], cmnd->pdu.datasize);
460
461 if (!(size = cmnd->pdu.datasize))
462 return;
463
464 if (tio)
465 assert(tio->pg_cnt > 0);
466 else
467 tio = cmnd->tio = tio_alloc(1);
468
469 addr = page_address(tio->pvec[0]);
470 assert(addr);
471 size = (size + 3) & -4;
472 conn->read_size = size;
473 for (i = 0; size > PAGE_CACHE_SIZE; i++, size -= PAGE_CACHE_SIZE) {
474 assert(i < ISCSI_CONN_IOV_MAX);
475 conn->read_iov[i].iov_base = addr;
476 conn->read_iov[i].iov_len = PAGE_CACHE_SIZE;
477 }
478 conn->read_iov[i].iov_base = addr;
479 conn->read_iov[i].iov_len = size;
480 conn->read_msg.msg_iov = conn->read_iov;
481 conn->read_msg.msg_iovlen = ++i;
482}
483
484static void iscsi_cmnd_reject(struct iscsi_cmnd *req, int reason)
485{
486 struct iscsi_cmnd *rsp;
487 struct iscsi_reject_hdr *rsp_hdr;
488 struct tio *tio;
489 char *addr;
490
491 rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
492 rsp_hdr = (struct iscsi_reject_hdr *)&rsp->pdu.bhs;
493
494 rsp_hdr->opcode = ISCSI_OP_REJECT;
495 rsp_hdr->ffffffff = ISCSI_RESERVED_TAG;
496 rsp_hdr->reason = reason;
497
498 rsp->tio = tio = tio_alloc(1);
499 addr = page_address(tio->pvec[0]);
500 clear_page(addr);
501 memcpy(addr, &req->pdu.bhs, sizeof(struct iscsi_hdr));
502 tio->size = rsp->pdu.datasize = sizeof(struct iscsi_hdr);
503 cmnd_skip_pdu(req);
504
505 req->pdu.bhs.opcode = ISCSI_OP_PDU_REJECT;
506}
507
508static void cmnd_set_sn(struct iscsi_cmnd *cmnd, int set_stat_sn)
509{
510 struct iscsi_conn *conn = cmnd->conn;
511 struct iscsi_session *sess = conn->session;
512
513 if (set_stat_sn)
514 cmnd->pdu.bhs.sn = cpu_to_be32(conn->stat_sn++);
515 cmnd->pdu.bhs.exp_sn = cpu_to_be32(sess->exp_cmd_sn);
516 cmnd->pdu.bhs.max_sn = cpu_to_be32(sess->exp_cmd_sn + sess->max_queued_cmnds);
517}
518
519static void update_stat_sn(struct iscsi_cmnd *cmnd)
520{
521 struct iscsi_conn *conn = cmnd->conn;
522 u32 exp_stat_sn;
523
524 cmnd->pdu.bhs.exp_sn = exp_stat_sn = be32_to_cpu(cmnd->pdu.bhs.exp_sn);
525 dprintk(D_GENERIC, "%x,%x\n", cmnd_opcode(cmnd), exp_stat_sn);
526 if ((int)(exp_stat_sn - conn->exp_stat_sn) > 0 &&
527 (int)(exp_stat_sn - conn->stat_sn) <= 0) {
528 // free pdu resources
529 cmnd->conn->exp_stat_sn = exp_stat_sn;
530 }
531}
532
533static int check_cmd_sn(struct iscsi_cmnd *cmnd)
534{
535 struct iscsi_session *session = cmnd->conn->session;
536 u32 cmd_sn;
537
538 cmnd->pdu.bhs.sn = cmd_sn = be32_to_cpu(cmnd->pdu.bhs.sn);
539
540 dprintk(D_GENERIC, "cmd_sn(%u) exp_cmd_sn(%u) max_cmd_sn(%u)\n",
541 cmd_sn, session->exp_cmd_sn, session->max_cmd_sn);
542
543 if (between(cmd_sn, session->exp_cmd_sn, session->max_cmd_sn))
544 return 0;
545 else if (cmnd_immediate(cmnd))
546 return 0;
547
548 eprintk("sequence error: cmd_sn(%u) exp_cmd_sn(%u) max_cmd_sn(%u)\n",
549 cmd_sn, session->exp_cmd_sn, session->max_cmd_sn);
550
551 set_cmnd_tmfabort(cmnd);
552
553 return -ISCSI_REASON_PROTOCOL_ERROR;
554}
555
556static struct iscsi_cmnd *__cmnd_find_hash(struct iscsi_session *session, u32 itt, u32 ttt)
557{
558 struct list_head *head;
559 struct iscsi_cmnd *cmnd;
560
561 head = &session->cmnd_hash[cmnd_hashfn(itt)];
562
563 list_for_each_entry(cmnd, head, hash_list) {
564 if (cmnd->pdu.bhs.itt == itt) {
565 if ((ttt != ISCSI_RESERVED_TAG) && (ttt != cmnd->target_task_tag))
566 continue;
567 return cmnd;
568 }
569 }
570
571 return NULL;
572}
573
574static struct iscsi_cmnd *cmnd_find_hash(struct iscsi_session *session, u32 itt, u32 ttt)
575{
576 struct iscsi_cmnd *cmnd;
577
578 spin_lock(&session->cmnd_hash_lock);
579
580 cmnd = __cmnd_find_hash(session, itt, ttt);
581
582 spin_unlock(&session->cmnd_hash_lock);
583
584 return cmnd;
585}
586
587static int cmnd_insert_hash_ttt(struct iscsi_cmnd *cmnd, u32 ttt)
588{
589 struct iscsi_session *session = cmnd->conn->session;
590 struct iscsi_cmnd *tmp;
591 struct list_head *head;
592 int err = 0;
593 u32 itt = cmnd->pdu.bhs.itt;
594
595 head = &session->cmnd_hash[cmnd_hashfn(itt)];
596
597 spin_lock(&session->cmnd_hash_lock);
598
599 tmp = __cmnd_find_hash(session, itt, ttt);
600 if (!tmp) {
601 list_add_tail(&cmnd->hash_list, head);
602 set_cmnd_hashed(cmnd);
603 } else
604 err = -ISCSI_REASON_TASK_IN_PROGRESS;
605
606 spin_unlock(&session->cmnd_hash_lock);
607
608 return err;
609}
610
611static int cmnd_insert_hash(struct iscsi_cmnd *cmnd)
612{
613 int err;
614
615 dprintk(D_GENERIC, "%p:%x\n", cmnd, cmnd->pdu.bhs.itt);
616
617 if (cmnd->pdu.bhs.itt == ISCSI_RESERVED_TAG)
618 return -ISCSI_REASON_PROTOCOL_ERROR;
619
620 err = cmnd_insert_hash_ttt(cmnd, ISCSI_RESERVED_TAG);
621 if (!err) {
622 update_stat_sn(cmnd);
623 err = check_cmd_sn(cmnd);
624 } else if (!cmnd_immediate(cmnd))
625 set_cmnd_tmfabort(cmnd);
626
627 return err;
628}
629
630static void __cmnd_remove_hash(struct iscsi_cmnd *cmnd)
631{
632 list_del(&cmnd->hash_list);
633}
634
635static void cmnd_remove_hash(struct iscsi_cmnd *cmnd)
636{
637 struct iscsi_session *session = cmnd->conn->session;
638 struct iscsi_cmnd *tmp;
639
640 spin_lock(&session->cmnd_hash_lock);
641
642 tmp = __cmnd_find_hash(session, cmnd->pdu.bhs.itt,
643 cmnd->target_task_tag);
644 if (tmp && tmp == cmnd)
645 __cmnd_remove_hash(tmp);
646 else
647 eprintk("%p:%x not found\n", cmnd, cmnd_itt(cmnd));
648
649 spin_unlock(&session->cmnd_hash_lock);
650}
651
652static void cmnd_skip_data(struct iscsi_cmnd *req)
653{
654 struct iscsi_cmnd *rsp;
655 struct iscsi_scsi_rsp_hdr *rsp_hdr;
656 u32 size;
657
658 rsp = get_rsp_cmnd(req);
659 rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs;
660 if (cmnd_opcode(rsp) != ISCSI_OP_SCSI_RSP) {
661 eprintk("unexpected response command %u\n", cmnd_opcode(rsp));
662 return;
663 }
664
665 size = cmnd_write_size(req);
666 if (size) {
667 rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
668 rsp_hdr->residual_count = cpu_to_be32(size);
669 }
670 size = cmnd_read_size(req);
671 if (size) {
672 if (cmnd_hdr(req)->flags & ISCSI_CMD_WRITE) {
673 rsp_hdr->flags |= ISCSI_FLG_BIRESIDUAL_UNDERFLOW;
674 rsp_hdr->bi_residual_count = cpu_to_be32(size);
675 } else {
676 rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
677 rsp_hdr->residual_count = cpu_to_be32(size);
678 }
679 }
680 req->pdu.bhs.opcode =
681 (req->pdu.bhs.opcode & ~ISCSI_OPCODE_MASK) | ISCSI_OP_SCSI_REJECT;
682
683 cmnd_skip_pdu(req);
684}
685
686static int cmnd_recv_pdu(struct iscsi_conn *conn, struct tio *tio, u32 offset, u32 size)
687{
688 int idx, i;
689 char *addr;
690
691 dprintk(D_GENERIC, "%p %u,%u\n", tio, offset, size);
692 offset += tio->offset;
693
694 if (!(offset < tio->offset + tio->size) ||
695 !(offset + size <= tio->offset + tio->size)) {
696 eprintk("%u %u %u %u", offset, size, tio->offset, tio->size);
697 return -EIO;
698 }
699 assert(offset < tio->offset + tio->size);
700 assert(offset + size <= tio->offset + tio->size);
701
702 idx = offset >> PAGE_CACHE_SHIFT;
703 offset &= ~PAGE_CACHE_MASK;
704
705 conn->read_msg.msg_iov = conn->read_iov;
706 conn->read_size = size = (size + 3) & -4;
707 conn->read_overflow = 0;
708
709 i = 0;
710 while (1) {
711 assert(tio->pvec[idx]);
712 addr = page_address(tio->pvec[idx]);
713 assert(addr);
714 conn->read_iov[i].iov_base = addr + offset;
715 if (offset + size <= PAGE_CACHE_SIZE) {
716 conn->read_iov[i].iov_len = size;
717 conn->read_msg.msg_iovlen = ++i;
718 break;
719 }
720 conn->read_iov[i].iov_len = PAGE_CACHE_SIZE - offset;
721 size -= conn->read_iov[i].iov_len;
722 offset = 0;
723 if (++i >= ISCSI_CONN_IOV_MAX) {
724 conn->read_msg.msg_iovlen = i;
725 conn->read_overflow = size;
726 conn->read_size -= size;
727 break;
728 }
729
730 idx++;
731 }
732
733 return 0;
734}
735
736static void set_offset_and_length(struct iet_volume *lu, u8 *cmd, loff_t *off, u32 *len)
737{
738 assert(lu);
739
740 switch (cmd[0]) {
741 case READ_6:
742 case WRITE_6:
743 *off = ((cmd[1] & 0x1f) << 16) + (cmd[2] << 8) + cmd[3];
744 *len = cmd[4];
745 if (!*len)
746 *len = 256;
747 break;
748 case READ_10:
749 case WRITE_10:
750 case WRITE_VERIFY:
751 *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
752 (u32)cmd[4] << 8 | (u32)cmd[5];
753 *len = (cmd[7] << 8) + cmd[8];
754 break;
755 case READ_16:
756 case WRITE_16:
757 *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
758 (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
759 (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
760 (u64)cmd[8] << 8 | (u64)cmd[9];
761 *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
762 (u32)cmd[12] << 8 | (u32)cmd[13];
763 break;
764 default:
765 BUG();
766 }
767
768 *off <<= lu->blk_shift;
769 *len <<= lu->blk_shift;
770}
771
772static u32 translate_lun(u16 * data)
773{
774 u8 *p = (u8 *) data;
775 u32 lun = ~0U;
776
777 switch (*p >> 6) {
778 case 0:
779 lun = p[1];
780 break;
781 case 1:
782 lun = (0x3f & p[0]) << 8 | p[1];
783 break;
784 case 2:
785 case 3:
786 default:
787 eprintk("%u %u %u %u\n", data[0], data[1], data[2], data[3]);
788 break;
789 }
790
791 return lun;
792}
793
794static void send_r2t(struct iscsi_cmnd *req)
795{
796 struct iscsi_cmnd *rsp;
797 struct iscsi_r2t_hdr *rsp_hdr;
798 u32 length, offset, burst;
799 LIST_HEAD(send);
800
801 length = req->r2t_length;
802 burst = req->conn->session->param.max_burst_length;
803 offset = be32_to_cpu(cmnd_hdr(req)->data_length) - length;
804
805 do {
806 rsp = iscsi_cmnd_create_rsp_cmnd(req, 0);
807 rsp->pdu.bhs.ttt = req->target_task_tag;
808
809 rsp_hdr = (struct iscsi_r2t_hdr *)&rsp->pdu.bhs;
810 rsp_hdr->opcode = ISCSI_OP_R2T;
811 rsp_hdr->flags = ISCSI_FLG_FINAL;
812 memcpy(rsp_hdr->lun, cmnd_hdr(req)->lun, 8);
813 rsp_hdr->itt = cmnd_hdr(req)->itt;
814 rsp_hdr->r2t_sn = cpu_to_be32(req->r2t_sn++);
815 rsp_hdr->buffer_offset = cpu_to_be32(offset);
816 if (length > burst) {
817 rsp_hdr->data_length = cpu_to_be32(burst);
818 length -= burst;
819 offset += burst;
820 } else {
821 rsp_hdr->data_length = cpu_to_be32(length);
822 length = 0;
823 }
824
825 dprintk(D_WRITE, "%x %u %u %u %u\n", cmnd_itt(req),
826 be32_to_cpu(rsp_hdr->data_length),
827 be32_to_cpu(rsp_hdr->buffer_offset),
828 be32_to_cpu(rsp_hdr->r2t_sn), req->outstanding_r2t);
829
830 list_add_tail(&rsp->list, &send);
831
832 if (++req->outstanding_r2t >= req->conn->session->param.max_outstanding_r2t)
833 break;
834
835 } while (length);
836
837 iscsi_cmnds_init_write(&send);
838}
839
840static void scsi_cmnd_exec(struct iscsi_cmnd *cmnd)
841{
842 assert(!cmnd->r2t_length);
843
844 if (cmnd->lun) {
845 iscsi_scsi_queuecmnd(cmnd);
846 } else {
847 iscsi_device_queue_cmnd(cmnd);
848 }
849}
850
851static int nop_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
852{
853 u32 size, tmp;
854 int i, err = 0;
855
856 if (cmnd_ttt(cmnd) != cpu_to_be32(ISCSI_RESERVED_TAG)) {
857 cmnd->req = cmnd_find_hash(conn->session, cmnd->pdu.bhs.itt,
858 cmnd->pdu.bhs.ttt);
859 if (!cmnd->req) {
860 /*
861 * We didn't request this NOP-Out (by sending a
862 * NOP-In, see 10.18.2 of the RFC) or our fake NOP-Out
863 * timed out.
864 */
865 eprintk("initiator bug %x\n", cmnd_itt(cmnd));
866 err = -ISCSI_REASON_PROTOCOL_ERROR;
867 goto out;
868 }
869
870 del_timer_sync(&cmnd->req->timer);
871 clear_cmnd_timer_active(cmnd->req);
872 dprintk(D_GENERIC, "NOP-Out: %p, ttt %x, timer %p\n",
873 cmnd->req, cmnd_ttt(cmnd->req), &cmnd->req->timer);
874 }
875
876 if (cmnd_itt(cmnd) == cpu_to_be32(ISCSI_RESERVED_TAG)) {
877 if (!cmnd_immediate(cmnd))
878 eprintk("%s\n", "initiator bug!");
879 update_stat_sn(cmnd);
880 err = check_cmd_sn(cmnd);
881 if (err)
882 goto out;
883 } else if ((err = cmnd_insert_hash(cmnd)) < 0) {
884 eprintk("ignore this request %x\n", cmnd_itt(cmnd));
885 goto out;
886 }
887
888 if ((size = cmnd->pdu.datasize)) {
889 size = (size + 3) & -4;
890 conn->read_msg.msg_iov = conn->read_iov;
891 if (cmnd->pdu.bhs.itt != cpu_to_be32(ISCSI_RESERVED_TAG)) {
892 struct tio *tio;
893 int pg_cnt = get_pgcnt(size, 0);
894
895 assert(pg_cnt < ISCSI_CONN_IOV_MAX);
896 cmnd->tio = tio = tio_alloc(pg_cnt);
897 tio_set(tio, size, 0);
898
899 for (i = 0; i < pg_cnt; i++) {
900 conn->read_iov[i].iov_base
901 = page_address(tio->pvec[i]);
902 tmp = min_t(u32, size, PAGE_CACHE_SIZE);
903 conn->read_iov[i].iov_len = tmp;
904 conn->read_size += tmp;
905 size -= tmp;
906 }
907 } else {
908 for (i = 0; i < ISCSI_CONN_IOV_MAX; i++) {
909 conn->read_iov[i].iov_base = dummy_data;
910 tmp = min_t(u32, size, sizeof(dummy_data));
911 conn->read_iov[i].iov_len = tmp;
912 conn->read_size += tmp;
913 size -= tmp;
914 }
915 }
916 assert(!size);
917 conn->read_overflow = size;
918 conn->read_msg.msg_iovlen = i;
919 }
920
921out:
922 return err;
923}
924
925static u32 get_next_ttt(struct iscsi_session *session)
926{
927 u32 ttt;
928
929 if (session->next_ttt == ISCSI_RESERVED_TAG)
930 session->next_ttt++;
931 ttt = session->next_ttt++;
932
933 return cpu_to_be32(ttt);
934}
935
936static void scsi_cmnd_start(struct iscsi_conn *conn, struct iscsi_cmnd *req)
937{
938 struct iscsi_scsi_cmd_hdr *req_hdr = cmnd_hdr(req);
939
940 dprintk(D_GENERIC, "scsi command: %02x\n", req_hdr->scb[0]);
941
942 req->lun = volume_get(conn->session->target, translate_lun(req_hdr->lun));
943 if (!req->lun) {
944 switch (req_hdr->scb[0]) {
945 case INQUIRY:
946 case REPORT_LUNS:
947 break;
948 default:
949 eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
950 create_sense_rsp(req, ILLEGAL_REQUEST, 0x25, 0x0);
951 cmnd_skip_data(req);
952 goto out;
953 }
954 } else
955 set_cmnd_lunit(req);
956
957 switch (req_hdr->scb[0]) {
958 case SERVICE_ACTION_IN:
959 if ((req_hdr->scb[1] & 0x1f) != 0x10)
960 goto error;
961 case INQUIRY:
962 case REPORT_LUNS:
963 case TEST_UNIT_READY:
964 case SYNCHRONIZE_CACHE:
965 case VERIFY:
966 case VERIFY_16:
967 case START_STOP:
968 case READ_CAPACITY:
969 case MODE_SENSE:
970 case REQUEST_SENSE:
971 case RESERVE:
972 case RELEASE:
973 {
974 if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) {
975 /* unexpected unsolicited data */
976 eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
977 create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc);
978 cmnd_skip_data(req);
979 }
980 break;
981 }
982 case READ_6:
983 case READ_10:
984 case READ_16:
985 {
986 loff_t offset;
987 u32 length;
988
989 if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) {
990 /* unexpected unsolicited data */
991 eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
992 create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc);
993 cmnd_skip_data(req);
994 break;
995 }
996
997 set_offset_and_length(req->lun, req_hdr->scb, &offset, &length);
998 req->tio = tio_alloc(get_pgcnt(length, offset));
999 tio_set(req->tio, length, offset);
1000 break;
1001 }
1002 case WRITE_6:
1003 case WRITE_10:
1004 case WRITE_16:
1005 case WRITE_VERIFY:
1006 {
1007 struct iscsi_sess_param *param = &conn->session->param;
1008 loff_t offset;
1009 u32 length;
1010
1011 req->r2t_length = be32_to_cpu(req_hdr->data_length) - req->pdu.datasize;
1012 req->is_unsolicited_data = !(req_hdr->flags & ISCSI_CMD_FINAL);
1013 req->target_task_tag = get_next_ttt(conn->session);
1014
1015 if (LUReadonly(req->lun)) {
1016 create_sense_rsp(req, DATA_PROTECT, 0x27, 0x0);
1017 cmnd_skip_data(req);
1018 break;
1019 }
1020
1021 if (!param->immediate_data && req->pdu.datasize)
1022 eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
1023
1024 if (param->initial_r2t && !(req_hdr->flags & ISCSI_CMD_FINAL))
1025 eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
1026
1027 if (req_hdr->scb[0] == WRITE_VERIFY && req_hdr->scb[1] & 0x02)
1028 eprintk("Verification is ignored %x\n", cmnd_itt(req));
1029
1030 set_offset_and_length(req->lun, req_hdr->scb, &offset, &length);
1031 if (cmnd_write_size(req) != length)
1032 eprintk("%x %u %u\n", cmnd_itt(req), cmnd_write_size(req), length);
1033
1034 req->tio = tio_alloc(get_pgcnt(length, offset));
1035 tio_set(req->tio, length, offset);
1036
1037 if (req->pdu.datasize) {
1038 if (cmnd_recv_pdu(conn, req->tio, 0, req->pdu.datasize) < 0)
1039 assert(0);
1040 }
1041 break;
1042 }
1043 error:
1044 default:
1045 eprintk("Unsupported %x\n", req_hdr->scb[0]);
1046 create_sense_rsp(req, ILLEGAL_REQUEST, 0x20, 0x0);
1047 cmnd_skip_data(req);
1048 break;
1049 }
1050
1051out:
1052 return;
1053}
1054
1055static void data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
1056{
1057 struct iscsi_data_out_hdr *req = (struct iscsi_data_out_hdr *)&cmnd->pdu.bhs;
1058 struct iscsi_cmnd *scsi_cmnd = NULL;
1059 u32 offset = be32_to_cpu(req->buffer_offset);
1060
1061 update_stat_sn(cmnd);
1062
1063 cmnd->req = scsi_cmnd = cmnd_find_hash(conn->session, req->itt, req->ttt);
1064 if (!scsi_cmnd) {
1065 eprintk("unable to find scsi task %x %x\n",
1066 cmnd_itt(cmnd), cmnd_ttt(cmnd));
1067 goto skip_data;
1068 }
1069
1070 if (scsi_cmnd->r2t_length < cmnd->pdu.datasize) {
1071 eprintk("invalid data len %x %u %u\n",
1072 cmnd_itt(scsi_cmnd), cmnd->pdu.datasize, scsi_cmnd->r2t_length);
1073 goto skip_data;
1074 }
1075
1076 if (scsi_cmnd->r2t_length + offset != cmnd_write_size(scsi_cmnd)) {
1077 eprintk("%x %u %u %u\n", cmnd_itt(scsi_cmnd), scsi_cmnd->r2t_length,
1078 offset, cmnd_write_size(scsi_cmnd));
1079 goto skip_data;
1080 }
1081
1082 scsi_cmnd->r2t_length -= cmnd->pdu.datasize;
1083
1084 if (req->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) {
1085 /* unsolicited burst data */
1086 if (scsi_cmnd->pdu.bhs.flags & ISCSI_FLG_FINAL) {
1087 eprintk("unexpected data from %x %x\n",
1088 cmnd_itt(cmnd), cmnd_ttt(cmnd));
1089 goto skip_data;
1090 }
1091 }
1092
1093 dprintk(D_WRITE, "%u %p %p %p %u %u\n", req->ttt, cmnd, scsi_cmnd,
1094 scsi_cmnd->tio, offset, cmnd->pdu.datasize);
1095
1096 if (cmnd_recv_pdu(conn, scsi_cmnd->tio, offset, cmnd->pdu.datasize) < 0)
1097 goto skip_data;
1098 return;
1099
1100skip_data:
1101 cmnd->pdu.bhs.opcode = ISCSI_OP_DATA_REJECT;
1102 cmnd_skip_pdu(cmnd);
1103 return;
1104}
1105
1106static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd);
1107
1108static void data_out_end(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
1109{
1110 struct iscsi_data_out_hdr *req = (struct iscsi_data_out_hdr *) &cmnd->pdu.bhs;
1111 struct iscsi_cmnd *scsi_cmnd;
1112 u32 offset;
1113
1114 assert(cmnd);
1115 scsi_cmnd = cmnd->req;
1116 assert(scsi_cmnd);
1117
1118 if (conn->read_overflow) {
1119 eprintk("%x %u\n", cmnd_itt(cmnd), conn->read_overflow);
1120 assert(scsi_cmnd->tio);
1121 offset = be32_to_cpu(req->buffer_offset);
1122 offset += cmnd->pdu.datasize - conn->read_overflow;
1123 if (cmnd_recv_pdu(conn, scsi_cmnd->tio, offset, conn->read_overflow) < 0)
1124 assert(0);
1125 return;
1126 }
1127
1128 if (req->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) {
1129 if (req->flags & ISCSI_FLG_FINAL) {
1130 scsi_cmnd->is_unsolicited_data = 0;
1131 iscsi_session_push_cmnd(scsi_cmnd);
1132 }
1133 } else {
1134 /* TODO : proper error handling */
1135 if (!(req->flags & ISCSI_FLG_FINAL) && scsi_cmnd->r2t_length == 0)
1136 eprintk("initiator error %x\n", cmnd_itt(scsi_cmnd));
1137
1138 if (!(req->flags & ISCSI_FLG_FINAL))
1139 goto out;
1140
1141 scsi_cmnd->outstanding_r2t--;
1142
1143 if (scsi_cmnd->r2t_length == 0)
1144 assert(list_empty(&scsi_cmnd->pdu_list));
1145
1146 iscsi_session_push_cmnd(scsi_cmnd);
1147 }
1148
1149out:
1150 iscsi_cmnd_remove(cmnd);
1151 return;
1152}
1153
1154static void __cmnd_abort(struct iscsi_cmnd *cmnd)
1155{
1156 if (cmnd_rxstart(cmnd))
1157 set_cmnd_tmfabort(cmnd);
1158
1159 if (cmnd_waitio(cmnd))
1160 return;
1161
1162 if (cmnd->conn->read_cmnd != cmnd)
1163 cmnd_release(cmnd, 1);
1164}
1165
1166static int cmnd_abort(struct iscsi_session *session, struct iscsi_cmnd *req)
1167{
1168 struct iscsi_task_mgt_hdr *req_hdr =
1169 (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
1170 struct iscsi_cmnd *cmnd;
1171
1172 u32 min_cmd_sn = req_hdr->cmd_sn - session->max_queued_cmnds;
1173
1174 req_hdr->ref_cmd_sn = be32_to_cpu(req_hdr->ref_cmd_sn);
1175
1176 dprintk(D_GENERIC, "cmd_sn(%u) ref_cmd_sn(%u) min_cmd_sn(%u) rtt(%x)"
1177 " lun(%d) cid(%u)\n",
1178 req_hdr->cmd_sn, req_hdr->ref_cmd_sn, min_cmd_sn, req_hdr->rtt,
1179 translate_lun(req_hdr->lun), req->conn->cid);
1180
1181 if (after(req_hdr->ref_cmd_sn, req_hdr->cmd_sn))
1182 return ISCSI_RESPONSE_FUNCTION_REJECTED;
1183
1184 if (!(cmnd = cmnd_find_hash(session, req_hdr->rtt, ISCSI_RESERVED_TAG))) {
1185 if (between(req_hdr->ref_cmd_sn, min_cmd_sn, req_hdr->cmd_sn))
1186 return ISCSI_RESPONSE_FUNCTION_COMPLETE;
1187 else
1188 return ISCSI_RESPONSE_UNKNOWN_TASK;
1189 }
1190
1191 dprintk(D_GENERIC, "itt(%x) opcode(%x) scsicode(%x) lun(%d) cid(%u)\n",
1192 cmnd_itt(cmnd), cmnd_opcode(cmnd), cmnd_scsicode(cmnd),
1193 translate_lun(cmnd_hdr(cmnd)->lun), cmnd->conn->cid);
1194
1195 if (cmnd_opcode(cmnd) == ISCSI_OP_SCSI_TASK_MGT_MSG)
1196 return ISCSI_RESPONSE_FUNCTION_REJECTED;
1197
1198 if (translate_lun(cmnd_hdr(cmnd)->lun) !=
1199 translate_lun(req_hdr->lun))
1200 return ISCSI_RESPONSE_FUNCTION_REJECTED;
1201
1202 if (cmnd->conn && test_bit(CONN_ACTIVE, &cmnd->conn->state)) {
1203 if (cmnd->conn->cid != req->conn->cid)
1204 return ISCSI_RESPONSE_FUNCTION_REJECTED;
1205 } else {
1206 /* Switch cmnd connection allegiance */
1207 }
1208
1209 __cmnd_abort(cmnd);
1210
1211 return ISCSI_RESPONSE_FUNCTION_COMPLETE;
1212}
1213
1214static int target_reset(struct iscsi_cmnd *req, u32 lun, int all)
1215{
1216 struct iscsi_target *target = req->conn->session->target;
1217 struct iscsi_session *session;
1218 struct iscsi_conn *conn;
1219 struct iscsi_cmnd *cmnd, *tmp;
1220 struct iet_volume *volume;
1221
1222 list_for_each_entry(session, &target->session_list, list) {
1223 list_for_each_entry(conn, &session->conn_list, list) {
1224 list_for_each_entry_safe(cmnd, tmp, &conn->pdu_list, conn_list) {
1225 if (cmnd == req)
1226 continue;
1227
1228 if (all)
1229 __cmnd_abort(cmnd);
1230 else if (translate_lun(cmnd_hdr(cmnd)->lun)
1231 == lun)
1232 __cmnd_abort(cmnd);
1233 }
1234 }
1235 }
1236
1237 list_for_each_entry(volume, &target->volumes, list) {
1238 if (all || volume->lun == lun) {
1239 /* force release */
1240 volume_release(volume, 0, 1);
1241 /* power-on, reset, or bus device reset occurred */
1242 ua_establish_for_all_sessions(target, volume->lun,
1243 0x29, 0x0);
1244 }
1245 }
1246
1247 return 0;
1248}
1249
1250static void task_set_abort(struct iscsi_cmnd *req)
1251{
1252 struct iscsi_session *session = req->conn->session;
1253 struct iscsi_conn *conn;
1254 struct iscsi_cmnd *cmnd, *tmp;
1255
1256 list_for_each_entry(conn, &session->conn_list, list) {
1257 list_for_each_entry_safe(cmnd, tmp, &conn->pdu_list, conn_list) {
1258 if (translate_lun(cmnd_hdr(cmnd)->lun)
1259 != translate_lun(cmnd_hdr(req)->lun))
1260 continue;
1261
1262 if (before(cmnd_hdr(cmnd)->cmd_sn,
1263 cmnd_hdr(req)->cmd_sn))
1264 __cmnd_abort(cmnd);
1265 }
1266 }
1267}
1268
1269static inline char *tmf_desc(int fun)
1270{
1271 static char *tmf_desc[] = {
1272 "Unknown Function",
1273 "Abort Task",
1274 "Abort Task Set",
1275 "Clear ACA",
1276 "Clear Task Set",
1277 "Logical Unit Reset",
1278 "Target Warm Reset",
1279 "Target Cold Reset",
1280 "Task Reassign",
1281 };
1282
1283 if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
1284 (fun > ISCSI_FUNCTION_TASK_REASSIGN))
1285 fun = 0;
1286
1287 return tmf_desc[fun];
1288}
1289
1290static inline char *rsp_desc(int rsp)
1291{
1292 static char *rsp_desc[] = {
1293 "Function Complete",
1294 "Unknown Task",
1295 "Unknown LUN",
1296 "Task Allegiant",
1297 "Failover Unsupported",
1298 "Function Unsupported",
1299 "No Authorization",
1300 "Function Rejected",
1301 "Unknown Response",
1302 };
1303
1304 if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
1305 (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
1306 (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
1307 rsp = 8;
1308 else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
1309 rsp = 7;
1310
1311 return rsp_desc[rsp];
1312}
1313
1314static void execute_task_management(struct iscsi_cmnd *req)
1315{
1316 struct iscsi_conn *conn = req->conn;
1317 struct iscsi_session *session = conn->session;
1318 struct iscsi_target *target = session->target;
1319 struct iscsi_cmnd *rsp;
1320 struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
1321 struct iscsi_task_rsp_hdr *rsp_hdr;
1322 u32 lun;
1323 int function = req_hdr->function & ISCSI_FUNCTION_MASK;
1324
1325 rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
1326 rsp_hdr = (struct iscsi_task_rsp_hdr *)&rsp->pdu.bhs;
1327
1328 rsp_hdr->opcode = ISCSI_OP_SCSI_TASK_MGT_RSP;
1329 rsp_hdr->flags = ISCSI_FLG_FINAL;
1330 rsp_hdr->itt = req_hdr->itt;
1331 rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
1332
1333 switch (function) {
1334 case ISCSI_FUNCTION_ABORT_TASK:
1335 case ISCSI_FUNCTION_ABORT_TASK_SET:
1336 case ISCSI_FUNCTION_CLEAR_ACA:
1337 case ISCSI_FUNCTION_CLEAR_TASK_SET:
1338 case ISCSI_FUNCTION_LOGICAL_UNIT_RESET:
1339 lun = translate_lun(req_hdr->lun);
1340 if (!volume_lookup(target, lun)) {
1341 rsp_hdr->response = ISCSI_RESPONSE_UNKNOWN_LUN;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: