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
1=== added directory '.pc'
2=== added file '.pc/.version'
3--- .pc/.version 1970-01-01 00:00:00 +0000
4+++ .pc/.version 2011-06-29 14:00:59 +0000
5@@ -0,0 +1,1 @@
6+2
7
8=== added file '.pc/applied-patches'
9--- .pc/applied-patches 1970-01-01 00:00:00 +0000
10+++ .pc/applied-patches 2011-06-29 14:00:59 +0000
11@@ -0,0 +1,2 @@
12+debian-changes-1.4.20.2-5
13+ubuntu-changes-1.4.20.2-5
14
15=== added directory '.pc/debian-changes-1.4.20.2-5'
16=== added file '.pc/debian-changes-1.4.20.2-5/ChangeLog'
17--- .pc/debian-changes-1.4.20.2-5/ChangeLog 1970-01-01 00:00:00 +0000
18+++ .pc/debian-changes-1.4.20.2-5/ChangeLog 2011-06-29 14:00:59 +0000
19@@ -0,0 +1,652 @@
20+Summary of changes from v1.4.20.1 to v1.4.20.2
21+=================================
22+Arne Redlich
23+ o uninitialized data fixes pointed out by valgrind
24+ o fix invalid read in iSNS code pointed out by valgrind
25+
26+Ross Walker
27+ o check buffer boundaries in iSNS code (CVE-2010-2221)
28+ o fix memleak in iSNS ACL code
29+ o clean up iSCSI login response error handling
30+ o rework ietd startup to avoid concurrent ietds
31+ o fix soft lockup during UA allocation
32+ o change DISTDIR to DESTDIR
33+ o avoid deletion of targets with active sessions
34+ o byte swap fix in MD5 / SHA1 code (thanks to Harshal Shete for testing on PPC)
35+
36+Summary of changes from v1.4.20 to v1.4.20.1
37+=================================
38+Arne Redlich
39+ o adapt backward compat mechanism in Makefile to kernels >= 2.6.33
40+
41+Ross Walker
42+ o restore SCSI SN behaviour of IET < 1.4.20 (VMWare compatibility)
43+
44+Summary of changes from v1.4.19 to v1.4.20
45+=================================
46+Minh Tran
47+ o fix TTT for final PDU in ietd
48+
49+Qinghua(Kevin) Ye
50+ o release reservations during session delete
51+
52+Ross Walker
53+ o multiple updates for abort task compliance
54+ o replace sync_page_range with filemap_write_and_wait_range in fileio
55+ o replace do_sync_read/write with vfs_read/write in fileio
56+ o multiple updates for target_del_all, atomic deletion of targets,
57+ sessions and connections
58+ o install moves existing kernel module, uninstall moves it back
59+ o cleaned up RPM and DKMS package building
60+ o cleaned up usr-kernel ioctl calls, added version checking, semaphore
61+ to prevent ioctls during kernel cleanup (target_del_all)
62+ o cleaned up session and connection reinstatement
63+ o setup IO contexts in wthread, fixes CFQ performance problem
64+ o enabled multiple connections per session
65+ o moved common parameters from iotypes to volume
66+ o UA handling on aborted/terminated connections
67+ o removed OpenSSL dependency by borrowing kernel md5/sha1 code
68+ o code cleanups
69+
70+Arne Redlich
71+ o multiple kernel compatibility updates
72+ o code cleanups
73+
74+Lars Ellenberg
75+ o support for logical sector sizes
76+ o case insensitive volume options
77+ o code cleanups
78+
79+Luca Berra
80+ o fix warnings when compiling via gcc strict checks
81+
82+Kun Huang
83+ o temporary target redirections via ietadm for existing targets
84+
85+Jagadish Kumar
86+ o multiple code cleanups around network and worker thread handling
87+
88+Summary of changes from v1.4.18 to v1.4.19
89+=================================
90+Andreas Florath
91+ o re-enable MaxSessions parameter
92+ o code cleanups
93+
94+Arne Redlich
95+ o NOP-In support
96+
97+Harshal Shete
98+ o add notes about cross compilation to README
99+
100+SZÉKELYI Szabolcs
101+ o fix ietadm manpage
102+
103+Ross S. W. Walker
104+ o fix initiators/targets.allow bugs
105+ o fix compiler warnings
106+ o fix return value of session_add()
107+ o update RPM specfile improving RedHat and SuSE compatibility
108+ (based on a patch from Matthew Wild)
109+ o update RELEASE NOTES
110+
111+Kevin Ye
112+ o fix session cleanup in case of -EPIPE during login
113+
114+
115+Summary of changes from v0.4.17 to v1.4.18
116+=================================
117+Lars Ellenberg
118+ o improve IETs procfs support to allow a larger number of targets
119+ o compatibility fix for 2.6.28 (independently also provided by Francois
120+ Micaux)
121+ o ignore SIGPIPE in ietd
122+ o allow cleanup of stale targets in the kernel module
123+
124+Andreas Florath
125+ o support for a global worker threadpool instead of per target pools
126+ (configurable via the worker_thread_pool_size module parameter)
127+
128+Arne Redlich
129+ o compatibility fixes for 2.6.30, 2.6.29
130+ o in cooperation with Xie Gang: Unit Attention support (thanks to Stefan
131+ Rubner for spotting a bug)
132+ o in cooperation with Shreyansh Jain: support for splitting text messages into
133+ several PDUs, allowing more targets to be reported during discovery
134+ (thanks to Cheng Rengquan for bugfixes)
135+ o clean up all connections, sessions and targets in the kernel module if the
136+ daemon is gone
137+ o rework sense data handling, plugging memleaks
138+ o fix valgrind warnings of uses of uninitialized variables
139+ o support for Reject PDUs (thanks to FUJITA Tomonori for a bugfix)
140+ o fix SERVICE ACTION IN: IET only supports READ CAPACITY 16, return sense data
141+ for all others
142+ o allow READ CAPACITY even if a LU is RESERVEd
143+ o iSNS: report the actual target port instead of the default iSCSI port
144+ o fix list corruption if target thread creation fails
145+ o fix stopping of threads that have never been awakened before
146+ o fix CHAP account handling bugs
147+ o fix netlink socket cleanup
148+ o code cleanups
149+
150+Cheng Renquan
151+ o remove superfluous linefeed from debug messages
152+ o enable runtime switching of debug levels for the kernel module and
153+ provide description for the module's debug flags parameter
154+
155+sdrb
156+ o return proper status class in case of login failures
157+
158+Ross S. W. Walker
159+ o support more than one portal per target during discovery, and allow
160+ configuration of the presented portals using targets.allow - previously only
161+ the incoming interface was reported (thanks to David Shirley for
162+ reporting a bug)
163+ o deprecate initiators.allow
164+ o regex based filtering in initiators.allow and targets.allow
165+ o move config files to /etc/iet
166+ o add version and author info and description to kernel module
167+ o fix debug log levels
168+ o fix ietd.conf permissions
169+ o move kernel module to /lib/modules/<kver>/extra where it belongs
170+ o improve init scripts, using common names and functions across distributions
171+ o improve usage comments in ietd.conf
172+ o specfile to build RPMs, including weak module support
173+ o DKMS support
174+
175+Ming Zhang
176+ o Use the LU's sector size in the format mode page instead of defaulting to 512
177+
178+Summary of changes from v0.4.16 to v0.4.17
179+=================================
180+
181+Charley Cheng
182+ o handle the \0-termination of strings properly when building iSNS TLVs
183+
184+Denis ChengRq
185+ o fix stopping of wthreads that have never been awakened
186+
187+Shreyansh Jain
188+ o fix debugging code that hexdumps PDU content to the syslog
189+
190+Jagadish Kumar
191+ o avoid busy looping if a connection's socket is out of wmem
192+
193+Arne Redlich
194+ o add support for "ietadm --op show --user"
195+ o SCSI fixes: MODE SENSE handling, INQUIRY CmdDt, HiSup, WCE and RCD handling
196+ o fix handling of NOP-Out w/ ping data
197+ o fix compilation against glibc >= 2.8
198+ o fix potential NULL-pointer derefences and resource leaks in the LUN param
199+ parsing code
200+ o documentation updates
201+
202+Ross S. W. Walker
203+ o 2.6.26 and SLES compile fix
204+ o SLES 10 SP2 compat patch
205+
206+Ming Zhang
207+ o make needlessly global function static
208+
209+
210+Summary of changes from v0.4.15 to v0.4.16
211+=================================
212+
213+Arne Redlich
214+ o fix overzealous assert() in digest_data()
215+ o add checking on return value of ISCSI_PARAM_GET
216+ o 2.6.22, 2.6.23 and 2.6.24 compile fixes
217+ o add conn->rwsize check
218+ o avoid potential NULL-ptr dereferences in rx and tx buffer
219+ o fix the shell syntax in init scripts
220+
221+Dave Jiang
222+ o fix digest endieness on LE archs
223+
224+FUJITA Tomonori
225+ o fix SPARC alignement issues (based on a patch from joel.bertrand@systella.fr)
226+
227+Ross S. W. Walker
228+ o fix DISTDIR in Makefile for /etc install
229+ o add support to nullio for volumes > 2TB
230+ o remove init.d memory size adjustment
231+ o add error code reporting to blockio_open_path
232+ o blockio gen_scsiid bug fix
233+ o add verbosity to kernel output and task management
234+
235+
236+Summary of changes from v0.4.14 to v0.4.15
237+=================================
238+
239+Juhani Rautiainen
240+ o Add RELEASE/RESERVE support
241+
242+Ross S. W. Walker
243+ o Improve the build system to support several kernel versions
244+ o Add block-io support
245+
246+
247+Summary of changes from v0.4.13 to v0.4.14
248+=================================
249+
250+Arne Redlich
251+ o Kill unused "state" in struct iscsi_cmnd.
252+ o Fixed fileio_sync() to propagate error to the caller (and initiator).
253+ o Don't attempt to show target/session params if communication with ietd
254+ fails.
255+ o Fixes to ietadm parameters handling.
256+
257+FUJITA Tomonori
258+ o rewritten iSNS code, many iSNS fixes.
259+ o added iSNS SCN support.
260+ o IPv6 fixes to userspace.
261+
262+Ming Zhang
263+ o Fix the READ_* commands error handling bug.
264+ o fix the mode sense response.
265+ o wrong #endif sequence in misc.h
266+
267+Richard Bollinger
268+ o add a patch to ietd.c that allows defunct sessions to go away.
269+ o add write-back cache and read-only support.
270+
271+Frederic Temporelli
272+ o Fix for the combination of 32-bit userland and 64-bit kernel on mips.
273+
274+Henry Liu
275+ o corrected many task management functions, prevent crashing on
276+ LUN RESET, TARGET WARM RESET.
277+
278+K Chapman
279+ o Fixed a typo in check_segment_length().
280+
281+Emmanuel Florac
282+ o Add ietadm manpage.
283+
284+
285+Summary of changes from v0.4.12 to v0.4.13
286+=================================
287+Arne Redlich
288+ o patch to avoid digest calculation for PDUs whose data has been skipped
289+ already for various reasons.
290+ o Correct a bug managing non-default MaxRxDSL.
291+ o added to ietadm ability to show target parameters.
292+ o add on the workaround to AIX initiator MaxCmdSN bug.
293+
294+FUJITA Tomonori
295+ o added to ietadm ability to show the iSCSI parameters for an established
296+ session.
297+
298+Ming Zhang
299+ o Fixed this bug : ietd should manage the iscsi name in a case insensitive
300+ way to conform to the RFC.
301+ o workaround to AIX initiator MaxCmdSN bug.
302+ o Fixed socket() return value judgment.
303+
304+Bastiaan Bakker
305+ o add 'condrestart' command to the RedHat initscript.
306+
307+Robert Whitehead
308+ o correct the bug that prevents iet to start if there isn't
309+ an /etc/ietd.conf file.
310+
311+
312+Summary of changes from v0.4.11 to v0.4.12
313+=================================
314+
315+Arne Redlich
316+ o Fix MaxRecvDataSegmentLength handling.
317+ o Fix login parameter handling.
318+ o Update man pages.
319+
320+Bastiaan Bakker
321+ o Add features to specify the listen address and port.
322+ o Fix setuid and setgid bugs in ietd daemon.
323+
324+FUJITA Tomonori
325+ o Add IPv6 support.
326+
327+Junjiro Okajima
328+ o Fix a bug about getting parameters from kernel space.
329+
330+Krzysztof Blaszkowski
331+ o Fix for requests with unaligned to 4 length.
332+
333+
334+Summary of changes from v0.4.10 to v0.4.11
335+=================================
336+
337+FUJITA Tomonori
338+ o Fix Task Management Function bugs.
339+
340+Ming Zhang
341+ o Update man pages.
342+
343+
344+Summary of changes from v0.4.9 to v0.4.10
345+=================================
346+
347+Arne Redlich
348+ o Fix 0x83 inquiry output.
349+ o Fix iSCSI parameter handling bugs.
350+
351+FUJITA Tomonori
352+ o Add the access control based on initiator address
353+ and target name patterns.
354+
355+Junjiro Okajima
356+ o Fix parameter checking bugs.
357+
358+Ming Zhang
359+ o Add the nullio mode (only useful for performance evaluation).
360+
361+
362+Summary of changes from v0.4.8 to v0.4.9
363+=================================
364+
365+FUJITA Tomonori
366+ o Fix parameter negotiation handling bugs.
367+
368+Wang Zhenyu
369+ o Fix digest negotiation handling bugs.
370+
371+
372+Summary of changes from v0.4.7 to v0.4.8
373+=================================
374+
375+FUJITA Tomonori
376+ o Fix unsolicited data handling bugs.
377+ o Rewrite parameter handling code.
378+ o Rewrite ietadm tool.
379+ o Improve dynamic configuration support.
380+ o Cleanups on the kernel-user interface.
381+ o Improve wrong PDU handling.
382+ o Implement a framework to handle multiple configuration methods.
383+ o Implement basic access control support.
384+
385+
386+Summary of changes from v0.4.6 to v0.4.7
387+=================================
388+
389+Florian Zierer
390+ o Add the startup script for Gentoo.
391+
392+FUJITA Tomonori
393+ o Rewrite parameter handling code.
394+ o Fix task management code bug.
395+ o Fix 0x83 inquiry output (Thanks to Christophe Varoqui).
396+
397+Ming Zhang
398+ o Acquire T10 ID.
399+ o Fix parameter handling bugs.
400+ o Some user-space cleanups.
401+
402+Philipp Hug
403+ o Fix ietd.8 man typo.
404+
405+
406+Summary of changes from v0.4.5 to v0.4.6
407+=================================
408+
409+FUJITA Tomonori
410+ o Replace the makeshift event notification code with netlink.
411+ o Add task management code except for ACA and reassign stuff.
412+ o Fix r2t lun bug (Thanks to Ming Zhang).
413+
414+
415+Summary of changes from v0.4.4 to v0.4.5
416+=================================
417+
418+FUJITA Tomonori
419+ o Rewrite the iSCSI command handling code.
420+ o Rewrite the I/O data handling code.
421+ o Fix worker thread.
422+ o Several cleanups.
423+
424+
425+Summary of changes from v0.4.3 to v0.4.4
426+=================================
427+
428+Krzysztof Blaszkowski
429+ o Fix an out-of-memory bug.
430+
431+
432+Summary of changes from v0.4.2 to v0.4.3
433+=================================
434+
435+Arne Redlich
436+ o Fix header digest bug.
437+ o Fix unexpected closed connection bug.
438+ o Fix iSCSI parameter bug.
439+
440+FUJITA Tomonori
441+ o Fix network thread.
442+
443+
444+Summary of changes from v0.4.1 to v0.4.2
445+=================================
446+
447+FUJITA Tomonori
448+ o Fix network thread.
449+ o Fix MaxOutstandingR2T handling.
450+
451+Ming Zhang
452+ o Add large volume support (over 2TB).
453+
454+
455+Summary of changes from v0.4.0 to v0.4.1
456+=================================
457+
458+Arne Redlich
459+ o Add mutual CHAP support. Note that you need to replace "User"
460+ with "IncomingUser" in ietd.conf.
461+
462+FUJITA Tomonori
463+ o Fix InitialR2T=No support.
464+ o Fix INQUIRY command handling.
465+ o Fix network and worker thread.
466+ o Start to split SCSI stuff.
467+ o Rewrite the R2T handling code.
468+ o Several cleanups.
469+
470+
471+Summary of changes from v0.3.8 to v0.4.0
472+=================================
473+
474+Arne Redlich
475+ o iSNS bug fix.
476+
477+FUJITA Tomonori
478+ o Move to 2.6 kernels.
479+ o Rewrite the kernel thread performing network I/O.
480+ o Add header and data digests (Thanks to Arne Redlich).
481+
482+Ming Zhang
483+ o Add mode sense page 0x3 and 0x4 support (Thanks to K Chapman).
484+ o iSNS bug fix.
485+
486+
487+Summary of changes from v0.3.7 to v0.3.8
488+=================================
489+
490+Arne Redlich
491+ o Fix ietadm global option bug.
492+
493+FUJITA Tomonori
494+ o Fix TCP option bugs (Thanks to Chuck Berg).
495+ o Fix REPORT LUN (handling lots of LUs).
496+
497+
498+Summary of changes from v0.3.6 to v0.3.7
499+=================================
500+
501+Arne Redlich
502+ o Fix target_alloc_pages().
503+
504+FUJITA Tomonori
505+ o Fix REPORT LUN bug.
506+
507+
508+Summary of changes from v0.3.5 to v0.3.6
509+=================================
510+
511+Arne Redlich
512+ o Fix bugs about rejecting PDUs.
513+
514+FUJITA Tomonori
515+ o Cleanups on target_cmnd structure.
516+ o Kill highmem stuff.
517+ o Fix REPORT LUN (handling lots of LUs).
518+
519+
520+Summary of changes from v0.3.4 to v0.3.5
521+=================================
522+
523+Arne Redlich
524+ o Fix ietd security hole.
525+ o Fix REPORT LUN bug.
526+ o FIX NOOP_OUT padding bug.
527+
528+FUJITA Tomonori
529+ o Rewrite event notification code.
530+
531+Libor Vanek
532+ o Add max_sessions option.
533+ o Fix command parsing bug.
534+
535+Ming Zhang
536+ o Cleanups for 64-bit architectures.
537+
538+
539+Summary of changes from v0.3.3 to v0.3.4
540+=================================
541+
542+FUJITA Tomonori
543+ o Improve dynamic configuration support (adding targets and users).
544+
545+
546+Summary of changes from v0.3.2 to v0.3.3
547+=================================
548+
549+FUJITA Tomonori
550+ o Fix Makefile for the startup script.
551+
552+
553+Summary of changes from v0.3.1 to v0.3.2
554+=================================
555+
556+Ali Lehmann
557+ o Add a new startup script for Debian.
558+
559+FUJITA Tomonori
560+ o Fix the istd's handling of connections in out-of-memory situations.
561+ o Fix bugs in regular file support.
562+ o Fix `ietadm --mode del all`.
563+
564+Libor Vanek
565+ o Add a new startup script for RedHat.
566+
567+Ming Zhang
568+ o Add uid/gid option to ietd daemon.
569+ o Fix a access freed-memory bug in kernel/daemon.c.
570+
571+
572+Summary of changes from v0.3.0 to v0.3.1
573+=================================
574+
575+FUJITA Tomonori
576+ o Fix memory leaks in ietd daemon (Thanks to Ming).
577+ o Fix bugs about REPORT_LUNS commands (Thanks to Ming).
578+ o Fix a bug about Target Task Tag.
579+ o Add regular file support to fileio mode.
580+
581+
582+Summary of changes from v0.2.6 to v0.3.0
583+=================================
584+
585+Ali Lehmann
586+ o Update ietd.8 man page.
587+
588+FUJITA Tomonori
589+ o Fix shutdown code.
590+ o Fix istd kernel thread bugs.
591+ o Replace procfs interface with ioctl.
592+ o Add dynamic configuration support.
593+ o Update README and the boot script.
594+
595+Ming Zhang
596+ o Add config option to ietd daemon.
597+
598+
599+Summary of changes from v0.2.5 to v0.2.6
600+=================================
601+
602+Ali Lehmann
603+ o Add ietd.8 and ietd.conf.5 man pages.
604+
605+FUJITA Tomonori
606+ o Update README, Makefile, and the boot script.
607+
608+
609+Summary of changes from v0.2.4 to v0.2.5
610+=================================
611+
612+FUJITA Tomonori
613+ o Update README.
614+
615+
616+Summary of changes from v0.2.3 to v0.2.4
617+=================================
618+
619+Ming Zhang
620+ o Add a preliminary iSNS support.
621+ o Fix merge mistakes that I made at the previous release.
622+
623+
624+Summary of changes from v0.2.2 to v0.2.3
625+=================================
626+
627+Ming Zhang
628+ o Improve INQUIRY, REQUEST_SENSE, and MODE_SENSE command supports
629+ o Add fake RESERVE* and RELEASE* command supports
630+
631+
632+Summary of changes from v0.2.1 to v0.2.2
633+=================================
634+
635+FUJITA Tomonori
636+ o Improve the write performance of the file IO mode
637+
638+Ming Zhang
639+ o Fix unupdated pg_cnt when allocating a new tcmnd
640+ o Several cleanups
641+
642+
643+Summary of changes from v0.2.0 to v0.2.1
644+=================================
645+
646+FUJITA Tomonori
647+ o Fix a bug that makes the target use CPU unnecessarily
648+ o Add a feature that enable you to pass options to an IO mode
649+
650+
651+Summary of changes from v0.1.0 to v0.2.0
652+=================================
653+
654+FUJITA Tomonori
655+ o Rewrite read and write kernel threads which perform network IO
656+ o Fix race issues in the proc interface
657+ o Fix shutdown code
658+
659+Ming Zhang
660+ o Fix memory leaks in file and block IO modes
661+
662+
663+Summary of changes from the ardis v20040211 to v0.1.0
664+=================================
665+
666+FUJITA Tomonori
667+ o Remove a kernel patch. Multiple threads execute I/O operations
668+ o Replace IO functions with the kernel starndard functions
669+ o Add multiple IO modes feature
670+ o Fix several race issues
671+ o Fix several out-of-memory situation bugs
672
673=== added file '.pc/debian-changes-1.4.20.2-5/Makefile'
674--- .pc/debian-changes-1.4.20.2-5/Makefile 1970-01-01 00:00:00 +0000
675+++ .pc/debian-changes-1.4.20.2-5/Makefile 2011-06-29 14:00:59 +0000
676@@ -0,0 +1,352 @@
677+#
678+# Makefile for the Linux kernel device drivers.
679+#
680+# Note! Dependencies are done automagically by 'make dep', which also
681+# removes any old dependencies. DON'T put your own dependencies here
682+# unless it's something special (not a .c file).
683+#
684+# Note 2! The CFLAGS definitions are now in the main makefile.
685+
686+#export KSRC := /usr/src/linux
687+
688+SUBDIRS := $(shell pwd)
689+
690+ifeq ($(KSRC),)
691+ KSRC ?= /lib/modules/$(shell uname -r)/build
692+endif
693+
694+
695+ifneq ($(wildcard $(KSRC)/include/generated/utsrelease.h),)
696+ VERSION_FILE := $(KSRC)/include/generated/utsrelease.h
697+else
698+ ifneq ($(wildcard $(KSRC)/include/linux/utsrelease.h),)
699+ VERSION_FILE := $(KSRC)/include/linux/utsrelease.h
700+ else
701+ VERSION_FILE := $(KSRC)/include/linux/version.h
702+ endif
703+endif
704+
705+KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \
706+ grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
707+
708+KMOD := /lib/modules/$(KVER)/extra
709+
710+KMAJ := $(shell echo $(KVER) | \
711+ sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
712+KMIN := $(shell echo $(KVER) | \
713+ sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
714+KREV := $(shell echo $(KVER) | \
715+ sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')
716+
717+kver_eq = $(shell [ $(KMAJ)$(KMIN)$(KREV) -eq $(1)$(2)$(3) ] && \
718+ echo 1 || echo 0)
719+kver_lt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -lt $(1)$(2)$(3) ] && \
720+ echo 1 || echo 0)
721+kver_le = $(shell [ $(KMAJ)$(KMIN)$(KREV) -le $(1)$(2)$(3) ] && \
722+ echo 1 || echo 0)
723+kver_gt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -gt $(1)$(2)$(3) ] && \
724+ echo 1 || echo 0)
725+kver_ge = $(shell [ $(KMAJ)$(KMIN)$(KREV) -ge $(1)$(2)$(3) ] && \
726+ echo 1 || echo 0)
727+kver_lk = $(shell [ `echo $(KVER) | egrep $(1)` ] && echo 1 || echo 0)
728+
729+#
730+# Please when adding patch sets start with the latest to the earliest
731+# the idea behind this is that by properly patching the latest code
732+# base first the earlier patch sets will not need to be modified.
733+#
734+
735+# Compatibility patch for kernels <= 2.6.32
736+ifeq ($(call kver_le,2,6,32),1)
737+ PATCHES := $(PATCHES) compat-2.6.32.patch
738+endif
739+
740+# Compatibility patch for kernels <= 2.6.31
741+ifeq ($(call kver_le,2,6,31),1)
742+ PATCHES := $(PATCHES) compat-2.6.31.patch
743+endif
744+
745+# Compatibility patch for kernels <= 2.6.30
746+ifeq ($(call kver_le,2,6,30),1)
747+ PATCHES := $(PATCHES) compat-2.6.30.patch
748+endif
749+
750+# Compatibility patch for kernels <= 2.6.29
751+ifeq ($(call kver_le,2,6,29),1)
752+ PATCHES := $(PATCHES) compat-2.6.29.patch
753+endif
754+
755+# Compatibility patch for kernels <= 2.6.28
756+ifeq ($(call kver_le,2,6,28),1)
757+ PATCHES := $(PATCHES) compat-2.6.28.patch
758+endif
759+
760+# Compatibility patch for kernels >= 2.6.25 and <= 2.6.27
761+ifeq ($(call kver_le,2,6,27),1)
762+ PATCHES := $(PATCHES) compat-2.6.25-2.6.27.patch
763+endif
764+
765+# Compatibility patch for kernels <= 2.6.24
766+ifeq ($(call kver_le,2,6,24),1)
767+ PATCHES := $(PATCHES) compat-2.6.24.patch
768+endif
769+
770+# Compatibility patch for kernels <= 2.6.23
771+ifeq ($(call kver_le,2,6,23),1)
772+ PATCHES := $(PATCHES) compat-2.6.23.patch
773+endif
774+
775+# Compatibility patch for kernels <= 2.6.22
776+ifeq ($(call kver_le,2,6,22),1)
777+ PATCHES := $(PATCHES) compat-2.6.22.patch
778+endif
779+
780+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
781+ifeq ($(call kver_le,2,6,21),1)
782+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
783+endif
784+
785+# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
786+ifeq ($(call kver_le,2,6,18),1)
787+ PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
788+endif
789+
790+# We don't support kernels < 2.6.14 except for explicit distros
791+ifeq ($(call kver_lt,2,6,14),1)
792+ UNSUPPORTED := true
793+endif
794+
795+# Compatibility patches for SuSE distros
796+ifneq ($(wildcard /etc/SuSE-release),)
797+ # Compatibility patch for SLES 10 SP2
798+ ifeq ($(call kver_lk,"2\.6\.16\.60-.*"),1)
799+ PATCHES += compat-sles10sp2.patch
800+ UNSUPPORTED :=
801+ endif
802+endif
803+
804+# Compatibility patches for Redhat distros
805+ifneq ($(wildcard /etc/redhat-release),)
806+ # Compatibility patch for RHEL4/CentOS4
807+ ifeq ($(call kver_lk,"2\.6\.9-.*\.(EL|plus\.c4)"),1)
808+ PATCHES += compat-rhel4.patch
809+ UNSUPPORTED :=
810+ endif
811+endif
812+
813+MANPAGES:= ietadm.8 ietd.8 ietd.conf.5
814+
815+ifeq ($(MANDIR),)
816+ MANPATH := $(shell (manpath 2>/dev/null || \
817+ echo $MANPATH) | sed 's/:/ /g')
818+ ifneq ($(MANPATH),)
819+ test_dir = $(findstring $(dir), $(MANPATH))
820+ else
821+ test_dir = $(shell [ -e $(dir) ] && echo $(dir))
822+ endif
823+ MANDIR := /usr/share/man /usr/man
824+ MANDIR := $(foreach dir, $(MANDIR), $(test_dir))
825+ MANDIR := $(firstword $(MANDIR))
826+endif
827+
828+ifeq ($(MANDIR),)
829+ MANDIR := /usr/share/man
830+endif
831+
832+DOCS:= ChangeLog COPYING RELEASE_NOTES README README.vmware README.initiators
833+
834+ifeq ($(DOCDIR),)
835+ DOCDIR := /usr/share/doc/iscsitarget
836+endif
837+
838+all: usr kernel
839+
840+usr: patch
841+ $(MAKE) -C usr
842+
843+kernel: patch
844+ $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel modules
845+
846+patch: $(UNSUPPORTED) integ_check $(PATCHES)
847+
848+$(UNSUPPORTED):
849+ @echo "Sorry, your kernel version and/or distribution is currently"
850+ @echo "not supported."
851+ @echo ""
852+ @echo "Please read the README file for information on how you can"
853+ @echo "contribute compatibility/bug fixes to the IET project."
854+ @exit 1
855+
856+integ_check:
857+ @if [ -e .patched.* -a ! -e .patched.$(KVER) ]; then \
858+ $(MAKE) unpatch; \
859+ fi
860+
861+$(PATCHES): .patched.$(KVER)
862+
863+.patched.$(KVER):
864+ @set -e; \
865+ if [ ! -e .patched.* ]; then \
866+ for p in $(PATCHES); do \
867+ echo "Applying Patch $$p"; \
868+ patch -p1 < patches/$$p; \
869+ echo $$p >>.patched.$(KVER); \
870+ done; \
871+ fi
872+
873+unpatch:
874+ @set -e; \
875+ if [ -e .patched.* ]; then \
876+ for p in `cat .patched.*`; do \
877+ reverse="$$p $$reverse"; \
878+ done; \
879+ for r in $$reverse; do \
880+ echo "Reversing patch $$r"; \
881+ patch -p1 -R < patches/$$r; \
882+ done; \
883+ rm -f .patched.*; \
884+ fi
885+
886+depmod:
887+ @echo "Running depmod"
888+ @if [ x$(DESTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
889+ depmod -aq -b $(DESTDIR)$(INSTALL_MOD_PATH) $(KVER); \
890+ else \
891+ depmod -aq $(KVER); \
892+ fi
893+
894+install-files: install-usr install-etc install-doc install-kernel
895+
896+install: install-files depmod
897+
898+install-kernel: kernel/iscsi_trgt.ko
899+ @if [ -d $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) ]; then \
900+ if [ -f /etc/debian_version ]; then \
901+ find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
902+ -name iscsi_trgt.ko -type f \
903+ -exec /bin/sh -c "dpkg-divert --rename {}" \;; \
904+ else \
905+ find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
906+ -name iscsi_trgt.ko -type f \
907+ -execdir mv \{\} \{\}.orig \;; \
908+ fi \
909+ fi
910+ @install -vD kernel/iscsi_trgt.ko \
911+ $(DESTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
912+
913+install-usr: usr/ietd usr/ietadm
914+ @install -vD usr/ietd $(DESTDIR)/usr/sbin/ietd
915+ @install -vD usr/ietadm $(DESTDIR)/usr/sbin/ietadm
916+
917+install-etc: install-initd
918+ @if [ ! -e $(DESTDIR)/etc/ietd.conf ]; then \
919+ if [ ! -e $(DESTDIR)/etc/iet/ietd.conf ]; then \
920+ install -vD -m 640 etc/ietd.conf \
921+ $(DESTDIR)/etc/iet/ietd.conf; \
922+ fi \
923+ fi
924+ @if [ ! -e $(DESTDIR)/etc/initiators.allow ]; then \
925+ if [ ! -e $(DESTDIR)/etc/iet/initiators.allow ]; then \
926+ install -vD -m 644 etc/initiators.allow \
927+ $(DESTDIR)/etc/iet/initiators.allow; \
928+ fi \
929+ fi
930+ @if [ ! -e $(DESTDIR)/etc/targets.allow ]; then \
931+ if [ ! -e $(DESTDIR)/etc/iet/targets.allow ]; then \
932+ install -vD -m 644 etc/targets.allow \
933+ $(DESTDIR)/etc/iet/targets.allow; \
934+ fi \
935+ fi
936+
937+install-initd:
938+ @if [ -f /etc/debian_version ]; then \
939+ install -vD -m 755 etc/initd/initd.debian \
940+ $(DESTDIR)/etc/init.d/iscsi-target; \
941+ elif [ -f /etc/redhat-release ]; then \
942+ install -vD -m 755 etc/initd/initd.redhat \
943+ $(DESTDIR)/etc/rc.d/init.d/iscsi-target; \
944+ elif [ -f /etc/gentoo-release ]; then \
945+ install -vD -m 755 etc/initd/initd.gentoo \
946+ $(DESTDIR)/etc/init.d/iscsi-target; \
947+ elif [ -f /etc/slackware-version ]; then \
948+ install -vD -m 755 etc/initd/initd \
949+ $(DESTDIR)/etc/rc.d/iscsi-target; \
950+ else \
951+ install -vD -m 755 etc/initd/initd \
952+ $(DESTDIR)/etc/init.d/iscsi-target; \
953+ fi
954+
955+install-doc: install-man
956+ @ok=true; for f in $(DOCS) ; \
957+ do [ -e $$f ] || \
958+ { echo $$f missing ; ok=false; } ; \
959+ done ; $$ok
960+ @set -e; for f in $(DOCS) ; do \
961+ install -v -D -m 644 $$f \
962+ $(DESTDIR)$(DOCDIR)/$$f ; \
963+ done
964+
965+install-man:
966+ @ok=true; for f in $(MANPAGES) ; \
967+ do [ -e doc/manpages/$$f ] || \
968+ { echo doc/manpages/$$f missing ; ok=false; } ; \
969+ done ; $$ok
970+ @set -e; for f in $(MANPAGES) ; do \
971+ s=$${f##*.}; \
972+ install -v -D -m 644 doc/manpages/$$f \
973+ $(DESTDIR)$(MANDIR)/man$$s/$$f ; \
974+ done
975+
976+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
977+
978+uninstall-kernel:
979+ rm -f $(DESTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
980+ @if [ -f /etc/debian_version ]; then \
981+ find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
982+ -name iscsi_trgt.ko.distrib -type f \
983+ -exec /bin/sh -c "dpkg-divert --remove --rename \
984+ \`dirname {}\`/iscsi_trgt.ko" \;; \
985+ else \
986+ find $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER) \
987+ -name iscsi_trgt.ko.orig -type f \
988+ -execdir mv \{\} iscsi_trgt.ko \;; \
989+ fi
990+
991+uninstall-usr:
992+ @rm -f $(DESTDIR)/usr/sbin/ietd
993+ @rm -f $(DESTDIR)/usr/sbin/ietadm
994+
995+uninstall-etc: uninstall-initd
996+
997+uninstall-initd:
998+ if [ -f /etc/debian_version ]; then \
999+ rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
1000+ elif [ -f /etc/redhat-release ]; then \
1001+ rm -f $(DESTDIR)/etc/rc.d/init.d/iscsi-target; \
1002+ elif [ -f /etc/gentoo-release ]; then \
1003+ rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
1004+ elif [ -f /etc/slackware-version ]; then \
1005+ rm -f $(DESTDIR)/etc/rc.d/iscsi-target; \
1006+ else \
1007+ rm -f $(DESTDIR)/etc/init.d/iscsi-target; \
1008+ fi
1009+
1010+uninstall-doc: uninstall-man
1011+ rm -rf $(DESTDIR)$(DOCDIR)
1012+
1013+uninstall-man:
1014+ set -e; for f in $(MANPAGES) ; do \
1015+ s=$${f##*.}; \
1016+ rm -f $(DESTDIR)$(MANDIR)/man$$s/$$f ; \
1017+ done
1018+
1019+clean:
1020+ $(MAKE) -C usr clean
1021+ $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel clean
1022+
1023+distclean: unpatch clean
1024+ find . -name \*.orig -exec rm -f \{\} \;
1025+ find . -name \*.rej -exec rm -f \{\} \;
1026+ find . -name \*~ -exec rm -f \{\} \;
1027+ find . -name Module.symvers -exec rm -f \{\} \;
1028+
1029
1030=== added file '.pc/debian-changes-1.4.20.2-5/RELEASE_NOTES'
1031--- .pc/debian-changes-1.4.20.2-5/RELEASE_NOTES 1970-01-01 00:00:00 +0000
1032+++ .pc/debian-changes-1.4.20.2-5/RELEASE_NOTES 2011-06-29 14:00:59 +0000
1033@@ -0,0 +1,176 @@
1034+ =========================================
1035+ Release Notes for iSCSI Enterprise Target
1036+ =========================================
1037+
1038+ July 14th, 2010
1039+ Version 1.4.20.2
1040+ ----------------
1041+
1042+The IET development team is pleased to announce the release of version
1043+1.4.20.2 of the iSCSI Enterprise Target.
1044+
1045+This release is a bugfix release. The following issues were fixed:
1046+- various issues in the iSNS code resulting from buffer boundaries not being
1047+ checked (CVE-2010-2221)
1048+- memory leak in the iSNS ACL code
1049+- the kernel module allocating UAs in atomic context could cause a soft lockup
1050+- handling iSCSI logins was faulty, causing issues with QLogic HBAs
1051+- ietd was not sufficiently protected against multiple instances
1052+- ietd exited when trying to remove targets with active sessions
1053+- MD5/SHA-1 used for CHAP authentication were faulty on big endian platforms
1054+
1055+ =========================================
1056+ Release Notes for iSCSI Enterprise Target
1057+ =========================================
1058+
1059+ April 25th, 2010
1060+ Version 1.4.20.1
1061+ ----------------
1062+
1063+The IET development team is pleased to announce the release of version
1064+1.4.20.1 of the iSCSI Enterprise Target.
1065+
1066+This release is a bugfix release. The following issues were fixed:
1067+- VMWare ESX does not recognize existing IET LUs after upgrading from older IET
1068+ versions to 1.4.20 because of a change in the SCSI SN. The old behaviour from
1069+ IET versions < 1.4.20 is restored with this release. Thanks to Steffen Plotner
1070+ for pointing it out and helping in debugging / testing.
1071+- With kernel 2.6.33 the utsrelease.h used by IETs backward compatibility
1072+ infrastructure was moved to a new location. This lead to compilation issues
1073+ with kernels >= 2.6.33.
1074+
1075+
1076+ April 13th, 2010
1077+ Version 1.4.20
1078+ --------------
1079+
1080+The IET development team is pleased to announce the release of version
1081+1.4.20 of the iSCSI Enterprise Target.
1082+
1083+This release includes numerous bug fixes and compatibility improvements
1084+and it is highly recommended that all production servers be on this
1085+version for compatibility and stability reasons.
1086+
1087+We would like to thank all those that contributed for this release. As
1088+we are a small project we rely heavily on user contributions and we
1089+welcome all who wish to participate in improving IET.
1090+
1091+New since 1.4.19:
1092+
1093+New Features:
1094+- Added ability to atomically delete all targets/sessions/connections
1095+- Added ability to move existing kernel module on install and move
1096+ back on uninstall per distribution requirements (dpkg-divert)
1097+- Added support for logical sector sizes (512, 1024, 2048, 4096)
1098+ and devices whose native sector size > 512
1099+- Added case insensitive volume parameter processing
1100+- Added ability to set temporary target redirections via ietadm
1101+ for existing targets
1102+- Added support for auto-generating MD5 hash for SCSI ID, if not
1103+ specified, and auto-setting SCSI SN to the hex of the SCSI ID,
1104+ if not specified.
1105+
1106+Experimental Features:
1107+- Added experimental support for multiple connections per session
1108+
1109+Updated Features:
1110+- Updated kernel compatibility to 2.6.33
1111+- Updated RPM and DKMS build/install/maintenance handling
1112+- Updated kernel and usr ioctl functions to perform version checking
1113+ between kernel module and ietd
1114+
1115+Fixes:
1116+- Fixed bug in ietd text final text response
1117+- Fixed bug with reservation release during session deletion
1118+- Fixed compliance issues around ABORT TASK/ABORT TASK SET
1119+- Fixed fileio so it should work with all file system types
1120+- Fixed session and connection reinstatement to work per RFC
1121+- Fixed performance issue with CFQ scheduler
1122+- Fixed corner case with fileio_sync missing last page in a sync
1123+- Fixed bug in ietd where an interface without an address would
1124+ cause it to go into an infinite loop.
1125+- Fixed race condition between issuing ioctls during kernel cleanup
1126+- Fixed race condition between ietd shutdown and initiators which
1127+ would cause initiators to fail to reconnect properly
1128+- Fixed a race condition with data-out handling with multiple
1129+ connections per session
1130+- Fixed possible wthread lost wakeup condition when the number of
1131+ wthreads is less then the number of CPUs/cores.
1132+
1133+
1134+ November 15th, 2009
1135+ Version 1.4.19
1136+ --------------
1137+
1138+The IET development team is pleased to announce the release of version
1139+1.4.19 of the iSCSI Enterprise Target.
1140+
1141+This release includes numerous bug fixes and compatibility improvements
1142+and it is highly recommended that all production servers be on this
1143+version for compatibility and stability reasons.
1144+
1145+We would like to thank all those that contributed for this release. As
1146+we are a small project we rely heavily on user contributions and we
1147+welcome all who wish to participate in improving IET.
1148+
1149+New since 1.4.18:
1150+
1151+- Added ability to limit number of sessions per target (MaxSessions)
1152+- Added NOP-In heartbeat for connections so dropped or abandoned
1153+ connections and their sessions close faster
1154+- Fixed a serious bug in initiators.allow code
1155+- Updated RPM .spec file with added SuSE compatibility and better
1156+ overall cross-platform friendliness.
1157+
1158+
1159+ October 5th, 2009
1160+ Version 1.4.18
1161+ --------------
1162+
1163+The version numbering of IET has changed in this release from the 0.X.X
1164+series to the 1.X.X series. We did this because we felt that, since IET
1165+has been stable and in production use for many years now, it deserved a
1166+version number that better reflected that stability and maturity. We
1167+are preserving the minor/maintenance numbers though in order to help
1168+maintain some consistency between prior and future releases.
1169+
1170+New since 0.4.17:
1171+
1172+- Added support for recent kernel versions up to 2.6.31
1173+- Added support for even more targets via:
1174+ * multi PDU support during discovery
1175+ * improved procfs support
1176+ * global thread pool (module parameter)
1177+- Added support to list all target addresses during discovery, with
1178+ the ability to filter those addresses via targets.allow
1179+- Replaced initiators.deny with an implicit deny on a failure to find
1180+ a match in initiators.allow while preserving backwards compatiblity
1181+ with existing installations (iff initiators.deny doesn't exist)
1182+- Added ability to filter initiators by their IQNs as well as their
1183+ IP addresses, using basic regex pattern to specify IQNs
1184+- Moved the config files to /etc/iet/ while preserving backwards
1185+ compatiblity with existing installations (iff a valid config file
1186+ exists in the new location will it be used)
1187+- Added support for Unit Attention Conditions
1188+ * SCSI RESERVE/RELEASE now issues a UAC on reservation loss
1189+- Added support for DKMS and building RPM packages right from the
1190+ source archive (from either the source tar ball or subversion)
1191+
1192+Plus many many bug and compatibility fixes (see ChangeLog for details)
1193+
1194+
1195+ Special thanks go to:
1196+ ---------------------
1197+
1198+Shreyansh Jain, Lars Ellenberg, Ming Zhang, Francois Micaux, Cheng Renquan,
1199+Andreas Florath, sdrb, Xie Gang, Stefan Rubner, FUJITA Tomonori, Oliver R.,
1200+Matthew Wild, Kevin Ye, Min Tran, Luca Berra, Kun Huang, VMware, spren,
1201+Jagadish Kumar, Steven Umbehocker, Emmanuel Florac, Harshal Shete,
1202+Tim Westervoorde, Andrei Tanas, Chris Siebenmann, Manoj Iyer, Rob Caldwell
1203+Pasi Karkkainen, Eugen Rieck and to all list members who submitted bug
1204+reports, suggestions and comments.
1205+
1206+Without whose contributions IET would not have been possible.
1207+
1208+Arne Redlich & Ross Walker
1209+
1210
1211=== added file '.pc/debian-changes-1.4.20.2-5/dkms.conf'
1212--- .pc/debian-changes-1.4.20.2-5/dkms.conf 1970-01-01 00:00:00 +0000
1213+++ .pc/debian-changes-1.4.20.2-5/dkms.conf 2011-06-29 14:00:59 +0000
1214@@ -0,0 +1,61 @@
1215+#
1216+# Master copy of dkms.conf for iscsitarget
1217+#
1218+
1219+PACKAGE_NAME="iscsitarget"
1220+PACKAGE_VERSION="1.4.20.2"
1221+MOD_PATH=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}
1222+
1223+BUILT_MODULE_NAME="iscsi_trgt"
1224+BUILT_MODULE_LOCATION="kernel"
1225+DEST_MODULE_LOCATION="/kernel/iscsi"
1226+
1227+MAKE="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/kernel modules"
1228+
1229+CLEAN="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/kernel clean"
1230+
1231+AUTOINSTALL="yes"
1232+
1233+#
1234+# Patches newest - oldest, distro spec at bottom
1235+#
1236+
1237+PATCH[0]="compat-2.6.32.patch"
1238+PATCH_MATCH[0]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32)"
1239+
1240+PATCH[1]="compat-2.6.31.patch"
1241+PATCH_MATCH[1]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)"
1242+
1243+PATCH[2]="compat-2.6.30.patch"
1244+PATCH_MATCH[2]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)"
1245+
1246+PATCH[3]="compat-2.6.29.patch"
1247+PATCH_MATCH[3]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)"
1248+
1249+PATCH[4]="compat-2.6.28.patch"
1250+PATCH_MATCH[4]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28)"
1251+
1252+PATCH[5]="compat-2.6.25-2.6.27.patch"
1253+PATCH_MATCH[5]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27)"
1254+
1255+PATCH[6]="compat-2.6.24.patch"
1256+PATCH_MATCH[6]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24)"
1257+
1258+PATCH[7]="compat-2.6.23.patch"
1259+PATCH_MATCH[7]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23)"
1260+
1261+PATCH[8]="compat-2.6.22.patch"
1262+PATCH_MATCH[8]="2\.6\.(9|14|15|16|17|18|19|20|21|22)"
1263+
1264+PATCH[9]="compat-2.6.19-2.6.21.patch"
1265+PATCH_MATCH[9]="2\.6\.(9|14|15|16|17|18|19|20|21)"
1266+
1267+PATCH[10]="compat-2.6.14-2.6.18.patch"
1268+PATCH_MATCH[10]="2\.6\.(9|14|15|16|17|18)"
1269+
1270+PATCH[11]="compat-sles10sp2.patch"
1271+PATCH_MATCH[11]="2\.6\.16\.60-.*"
1272+
1273+PATCH[12]="compat-rhel4.patch"
1274+PATCH_MATCH[12]="2\.6\.9-.*\.(el|plus\.c4)"
1275+
1276
1277=== added directory '.pc/debian-changes-1.4.20.2-5/doc'
1278=== added directory '.pc/debian-changes-1.4.20.2-5/doc/manpages'
1279=== added file '.pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5'
1280--- .pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5 1970-01-01 00:00:00 +0000
1281+++ .pc/debian-changes-1.4.20.2-5/doc/manpages/ietd.conf.5 2011-06-29 14:00:59 +0000
1282@@ -0,0 +1,336 @@
1283+.\" Process this file with
1284+.\" groff -man -Tascii ietd.conf.5
1285+.\"
1286+.TH "IETD.CONF" "5" "27 July 2005" "A. Lehmann, M. Zhang and A. Redlich" "File formats"
1287+.SH "NAME"
1288+/etc/ietd.conf \- configuration for iSCSI Enterprise Target Daemon
1289+.SH "SYNOPSIS"
1290+/etc/ietd.conf
1291+.SH "DESCRIPTION"
1292+/etc/ietd.conf contains configuration information for the
1293+.B ietd (8)
1294+command. This is the place, where you configure your iSCSI targets and daemon defaults.
1295+.P
1296+Only 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.
1297+.P
1298+The "Yes" and "No" for parameter values are case sensitive. The parameter names are case insensitive.
1299+.P
1300+The file consists of a global part and zero or more "Target" stanzas. Everything until the first target definition belongs to the global configuration.
1301+
1302+Here is an example:
1303+
1304+IncomingUser joe secret
1305+.br
1306+OutgoingUser jack secret2
1307+
1308+Target iqn.2001\-04.com.example:storage.disk2.sys1.xyz
1309+ IncomingUser jim othersecret
1310+ OutgoingUser james yetanothersecret
1311+ Lun 0 Path=/dev/sdc,Type=fileio
1312+ Lun 1 Blocks=10000,BlockSize=4096,Type=nullio
1313+ Alias Test
1314+ HeaderDigest None
1315+ DataDigest None
1316+ MaxConnections 1
1317+ MaxSessions 0
1318+ InitialR2T Yes
1319+ ImmediateData No
1320+ MaxRecvDataSegmentLength 8192
1321+ MaxXmitDataSegmentLength 8192
1322+ MaxBurstLength 262144
1323+ FirstBurstLength 65536
1324+ DefaultTime2Wait 2
1325+ DefaultTime2Retain 20
1326+ MaxOutstandingR2T 8
1327+ NOPInterval 0
1328+ NOPTimeout 0
1329+ DataPDUInOrder Yes
1330+ DataSequenceInOrder Yes
1331+ ErrorRecoveryLevel 0
1332+.P
1333+Stanzas 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.
1334+.SH "GLOBAL OPTIONS"
1335+Global Options are case sensitive.
1336+.TP
1337+.B [IncomingUser <username> <password>]
1338+The
1339+.I <username>
1340+and
1341+.I <password>
1342+used during discovery sessions to authenticate iSCSI initiators. Several of those can be specified for discovery. If no
1343+.B IncomingUser
1344+is specified, any initiator is allowed to open a discovery session.
1345+.RS
1346+HINT: RFC 3720 requires
1347+.I <password>
1348+to be 12 characters long. This is enforced e.g. by MS Initiator.
1349+.RE
1350+.TP
1351+.B [OutgoingUser <username> <password>]
1352+The
1353+.I <username>
1354+and
1355+.I <password>
1356+used during discovery sessions to authenticate the target to initiators. Only one outgoing
1357+.I <username>/<password>
1358+combination may be specified.
1359+.RS
1360+HINT: RFC 3720 requires
1361+.I <password>
1362+to be 12 characters long. This is enforced e.g. by MS Initiator.
1363+.RE
1364+.TP
1365+.B Target iqn.<yyyy\-mm>.<tld.domain.some.host>[:<identifier>]
1366+A target definition and the target name. The targets name (the
1367+.B iSCSI Qualified Name
1368+) must be a globally unique name (as defined by the iSCSI standard) and has to start with
1369+.I iqn
1370+followed by a single dot. The EUI\-64 form is not supported.
1371+.I <yyyy\-mm>
1372+is 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.
1373+The optional
1374+.I <identifier>
1375+\- which is freely selectable \- has to be separated by a single colon. For further details please check the iSCSI spec.
1376+
1377+Here is an example:
1378+
1379+Target iqn.2004\-07.com.example.host:storage.disk2.sys1.xyz
1380+.SH "TARGET OPTIONS"
1381+Target options are also case sensitive.
1382+.TP
1383+.B [IncomingUser <username> <password>]
1384+The
1385+.I <username>
1386+and
1387+.I <password>
1388+used 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
1389+.B IncomingUser
1390+Option, connections are allowed without authentication. A
1391+.I <password>
1392+has to be provided, if there is a
1393+.I <username>
1394+given. Specifying several different
1395+.B IncomingUser
1396+accounts is supported.
1397+.TP
1398+.B [OutgoingUser <username> <password>]
1399+The
1400+.I <username>
1401+and
1402+.I <password>
1403+used to authenticate this iSCSI target to initiators. Only one
1404+.B
1405+OutgoingUser
1406+per target is supported. It may be different from the username and password in section GLOBAL OPTIONS, which is used for discovery. A
1407+.I <password>
1408+has to be provided, if there is a
1409+.I <username>
1410+given.
1411+.TP
1412+.nf
1413+.B Lun <lun> Type=(fileio|blockio),Path=<device>[,ScsiId=<scsi_id>][,ScsiSN=<scsi_sn>][,IOMode=(wb|ro|wt)][,BlockSize=<size>]
1414+.TP
1415+.B Lun <lun> Type=nullio[,Blocks=<count>][,BlockSize=<size>]
1416+.fi
1417+.RS
1418+Parameters after <lun> should not contain any blank space characters except the first blank space after <lun> is needed.
1419+.P
1420+The value of
1421+.I <lun>
1422+can be from 0 to 16384. The first
1423+.I <lun>
1424+defined MUST be 0.
1425+.P
1426+In
1427+.I fileio
1428+mode (default), it defines a mapping between a "Logical Unit Number"
1429+.I <lun>
1430+and a given device
1431+.I <device>
1432+, 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.
1433+.P
1434+In
1435+.I blockio
1436+mode, it defines a mapping between a "Logical Unit Number"
1437+.I <lun>
1438+and a given block device
1439+.I <device>.
1440+This 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.
1441+.P
1442+A
1443+.I ScsiId
1444+can 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
1445+.I <device>
1446+through multiple iSCSI sessions. The
1447+.I <scsi_id>
1448+must not exceed 16 characters.
1449+.P
1450+Also a
1451+.I ScsiSN
1452+can 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
1453+.I <device>
1454+through multiple iSCSI sessions. The
1455+.I <scsi_sn>
1456+must not exceed 16 characters.
1457+.P
1458+By default LUNs are writable, employing write-through caching. By setting
1459+.I IOMode
1460+to "ro" a LUN can be set to read only mode. Setting
1461+.I IOMode
1462+to "wb" will enable write-back caching of a LUN. Setting
1463+.I IOMode
1464+to "wt" is only symbolic as that is the default behavior.
1465+.P
1466+.B NOTE:
1467+.I IOMode
1468+"wb" is ignored when employing blockio as it performs no caching.
1469+.P
1470+.B WARNING: IOMode=wb could lead to serious data loss from an unexpected system failure (power loss, system crash). Use at your own risk!
1471+.P
1472+You can specify a logical
1473+.I BlockSize
1474+for an iSCSI volume. This
1475+.I <size>
1476+must be one of (512, 1024, 2048, 4096). If
1477+.I BlockSize
1478+isn'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).
1479+.P
1480+.B NOTE:
1481+For blockio, you CANNOT specify a
1482+.I BlockSize
1483+less 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
1484+.I BlockSize
1485+less than the lower level device's logical block size.
1486+.P
1487+.B WARNING: Once your data is written at a given BlockSize you cannot change this BlockSize without risking corruption of your existing data.
1488+.P
1489+In
1490+.I nullio
1491+mode, it defines a mapping between a "Logical Unit Number"
1492+.I <lun>
1493+and an unnamed virtual device with a specified number of
1494+.I Blocks
1495+of
1496+.I BlockSize
1497+bytes. If
1498+.I Blocks
1499+is not specified then it will default to 64GB's worth given the curent
1500+.I BlockSize
1501+which 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.
1502+.P
1503+.B WARNING: By sending random kernel memory over the IP network you can potentially expose sensitive information.
1504+.RE
1505+.TP
1506+.B [Alias <aliasname>]
1507+This assigns an optional
1508+.I <aliasname>
1509+to the target.
1510+.TP
1511+.B [HeaderDigest <CRC32C|None>]
1512+Optional. 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.
1513+.TP
1514+.B [DataDigest <CRC32C|None>]
1515+Optional. 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.
1516+.TP
1517+.B [MaxConnections <value>]
1518+Optional. 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.
1519+.TP
1520+.B [MaxSessions <value>]
1521+Optional. The maximum number of sessions for this target. If this is set to 0 (wich is the default) there is no explicit session limit.
1522+.TP
1523+.B [InitialR2T <Yes|No>]
1524+Optional. 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
1525+.B FirstBurstLength
1526+bytes unsolicited right after and/or (depending on the setting of
1527+.B ImmediateData
1528+) together with the command. Thus setting it to "No" may improve performance.
1529+.TP
1530+.B [ImmediateData <Yes|No>]
1531+Optional. 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".
1532+.TP
1533+.B [MaxRecvDataSegmentLength <value>]
1534+Optional. Sets the maximum data segment length that can be received. The
1535+.I <value>
1536+should 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.
1537+.TP
1538+.B [MaxXmitDataSegmentLength <value>]
1539+Optional. Sets the maximum data segment length that can be sent. The
1540+.I <value>
1541+actually used is the minimum of
1542+.B MaxXmitDataSegmentLength
1543+and the
1544+.B MaxRecvDataSegmentLength
1545+announced by the initiator. The
1546+.I <value>
1547+should 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.
1548+.TP
1549+.B [MaxBurstLength <value>]
1550+Optional. 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
1551+.I <value>
1552+should 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.
1553+.TP
1554+.B [FirstBurstLength <value>]
1555+Optional. 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
1556+.B InitialR2T
1557+and
1558+.B ImmediateData
1559+.
1560+.I <value>
1561+should 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.
1562+.TP
1563+.B [DefaultTime2Wait <value>]
1564+Currently not supported.
1565+.TP
1566+.B [DefaultTime2Retain <value>]
1567+Currently not supported.
1568+.TP
1569+.B [MaxOutstandingR2T <value>]
1570+Optional. Controls the maximum number of data transfers the target may request at once, each of up to
1571+.B MaxBurstLength
1572+bytes. The default is 1.
1573+.TP
1574+.B [DataPDUInOrder <Yes|No>]
1575+Optional. Has to be set to "Yes" \- which is also the default.
1576+.TP
1577+.B [DataSequenceInOrder <Yes|No>]
1578+Optional. Has to be set to "Yes" \- which is also the default.
1579+.TP
1580+.B [ErrorRecoveryLevel <value>]
1581+Optional. Has to be set to "0" (in words: zero), which is also the default.
1582+.TP
1583+.B [NOPInterval <value>]
1584+Optional. If
1585+.I value
1586+is non-zero, the initiator will be "ping"ed during phases of inactivity (i.e. no data transfers) every
1587+.I value
1588+seconds to verify the connection is still alive. If the initiator fails to respond within
1589+.B NOPTimeout
1590+seconds, the connection will be closed.
1591+.TP
1592+.B [NOPTimeout <value>]
1593+Optional. If a non-zero
1594+.B NOPInterval
1595+is used to periodically "ping" the initiator during phases of inactivity (i.e. no data transfers), the initiator must respond within
1596+.I value
1597+seconds, otherwise the connection will be closed. If
1598+.I value
1599+is set to zero or if it exceeds
1600+.B NOPInterval
1601+, it will be set to
1602+.B NOPInterval.
1603+.TP
1604+.B [Wthreads <value>]
1605+Optional. 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.
1606+.TP
1607+.B [QueuedCommands <value>]
1608+Optional. 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
1609+.I value
1610+may be carefully adjusted. The default value of 32 should be sufficient for most purposes.
1611+.SH "KNOWN BUGS/LIMITATIONS"
1612+Currently (as of 0.4.11) not all iSCSI target parameters are used. Header and data digests are not supported during discovery sessions.
1613+.SH "SEE ALSO"
1614+.B ietd (8)
1615+.TP
1616+You should have a look at
1617+.B RFC 3720
1618+for all the glory details.
1619
1620=== added directory '.pc/debian-changes-1.4.20.2-5/etc'
1621=== added file '.pc/debian-changes-1.4.20.2-5/etc/ietd.conf'
1622--- .pc/debian-changes-1.4.20.2-5/etc/ietd.conf 1970-01-01 00:00:00 +0000
1623+++ .pc/debian-changes-1.4.20.2-5/etc/ietd.conf 2011-06-29 14:00:59 +0000
1624@@ -0,0 +1,110 @@
1625+# Example iscsi target configuration
1626+#
1627+# Everything until the first target definition belongs
1628+# to the global configuration.
1629+#
1630+# "iSNSServer" is the iSNS server you want your portal to register
1631+# with.
1632+#
1633+# "iSNSAccessControl" is for enabling initiator access control
1634+# through the iSNS server.
1635+#
1636+# "IncomingUser" specifies credentials the initiator has to provide -
1637+# several of these are supported. If mutual CHAP shall be employed,
1638+# "OutgoingUser" specifies the user/pass combination the target will
1639+# provide - only one is supported.
1640+#
1641+# Leave them alone (keep them commented out) if you don't want to use
1642+# authentication for discovery sessions.
1643+
1644+#iSNSServer 192.168.1.16
1645+#iSNSAccessControl No
1646+
1647+#IncomingUser joe secret
1648+#OutgoingUser jack 12charsecret
1649+
1650+# Targets definitions start with "Target" and the target name.
1651+# The target name must be a globally unique name, the iSCSI
1652+# standard defines the "iSCSI Qualified Name" as follows:
1653+#
1654+# iqn.yyyy-mm.<reversed domain name>[:identifier]
1655+#
1656+# "yyyy-mm" is the date at which the domain is valid and the identifier
1657+# is freely selectable. For further details please check the iSCSI spec.
1658+
1659+#Target iqn.2001-04.com.example:storage.disk2.sys1.xyz
1660+ # CHAP Users
1661+ #
1662+ # The same rules as for discovery users apply here.
1663+ #
1664+ # Don't set them if you don't want to use CHAP authentication.
1665+ #
1666+ #IncomingUser joe secret
1667+ #OutgoingUser jim 12charpasswd
1668+ #
1669+ # Logical Unit definition
1670+ #
1671+ # Block devices, regular files (fileio only), LVM, and RAID
1672+ # can be offered to the initiators as a block device.
1673+ #
1674+ # Lun numbers MUST start with zero (each target needs a Lun 0)
1675+ #
1676+ #Lun 0 Path=/dev/sdc,Type=fileio,ScsiId=xyz,ScsiSN=xyz
1677+ #
1678+ # Alias name for this target (Not Used)
1679+ #
1680+ #Alias Test
1681+ #
1682+ # Various iSCSI parameters
1683+ # (not all are used right now, see also iSCSI spec for details)
1684+ #
1685+ # Outgoing SCSI data (initiator to target user data or command
1686+ # parameters) is sent as either solicited data or unsolicited data.
1687+ # Solicited data is sent in response to R2T PDUs. Unsolicited data
1688+ # can be sent as part of an iSCSI command PDU sequence
1689+ # ("Immediate Data") or as a separate iSCSI data PDU sequence.
1690+ #
1691+ #MaxConnections 1 # Number of connections/session
1692+ # We only support 1
1693+ #MaxSessions 0 # Number of sessions/target
1694+ # 0 = no explicit limit
1695+ #InitialR2T Yes # Wait first for R2T
1696+ # Yes = no unsolicited data
1697+ #ImmediateData Yes # Data can accompany command
1698+ # Yes = cmnd/data in same PDU
1699+ #MaxRecvDataSegmentLength 8192 # Max data per PDU to receive
1700+ #MaxXmitDataSegmentLength 8192 # Max data per PDU to transmit
1701+ #MaxBurstLength 262144 # Max data per sequence (R2T)
1702+ #FirstBurstLength 65536 # Max unsolicited data sequence
1703+ #DefaultTime2Wait 2 # Secs wait for ini to log out
1704+ # Not used
1705+ #DefaultTime2Retain 20 # Secs keep cmnds after log out
1706+ # Not used
1707+ #MaxOutstandingR2T 1 # Max outstanding R2Ts per cmnd
1708+ #DataPDUInOrder Yes # Data in PDUs is ordered
1709+ # We only support ordered
1710+ #DataSequenceInOrder Yes # PDUs in sequence are ordered
1711+ # We only support ordered
1712+ #ErrorRecoveryLevel 0 # We only support level 0
1713+ #HeaderDigest None,CRC32C # PDU header checksum algo list
1714+ # None or CRC32C
1715+ # If only one is set then the
1716+ # initiator must agree to it
1717+ # or the connection will fail
1718+ #DataDigest None,CRC32C # PDU data checksum algo list
1719+ # Same as above
1720+ #MaxSessions 0 # Maximum number of sessions to
1721+ # this target - 0 = unlimited
1722+ #NOPInterval 0 # Send a NOP-In ping each after
1723+ # that many seconds if the conn
1724+ # is otherwise idle - 0 = off
1725+ #NOPTimeout 0 # Wait that many seconds for a
1726+ # response on a NOP-In ping
1727+ # If 0 or > NOPInterval, NOPInterval
1728+ # is used!
1729+ #
1730+ # Various target parameters
1731+ #
1732+ #Wthreads 8 # Number of IO threads
1733+ #QueuedCommands 32 # Number of queued commands
1734+
1735
1736=== added directory '.pc/debian-changes-1.4.20.2-5/etc/initd'
1737=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd'
1738--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd 1970-01-01 00:00:00 +0000
1739+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd 2011-06-29 14:00:59 +0000
1740@@ -0,0 +1,39 @@
1741+#!/bin/bash
1742+#
1743+# Start the iSCSI Enterprise Target.
1744+#
1745+
1746+PATH=/sbin:/bin:/usr/sbin:/usr/bin
1747+OPTIONS=""
1748+
1749+if [ -f /etc/sysconfig/iscsi-target ]; then
1750+ . /etc/sysconfig/iscsi-target
1751+fi
1752+
1753+start_server()
1754+{
1755+ modprobe -q crc32c
1756+ modprobe iscsi_trgt
1757+ /usr/sbin/ietd $OPTIONS
1758+}
1759+
1760+stop_server()
1761+{
1762+ ietadm --op delete
1763+ killall ietd
1764+}
1765+
1766+case "$1" in
1767+ start)
1768+ start_server
1769+ ;;
1770+ stop)
1771+ stop_server
1772+ ;;
1773+ *)
1774+ echo "Usage: {start|stop}" >&2
1775+ exit 1
1776+ ;;
1777+esac
1778+
1779+exit 0
1780
1781=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian'
1782--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian 1970-01-01 00:00:00 +0000
1783+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd.debian 2011-06-29 14:00:59 +0000
1784@@ -0,0 +1,75 @@
1785+#!/bin/sh
1786+#
1787+# chkconfig: - 39 35
1788+# description: Starts and stops the iSCSI target
1789+# debianized start-stop script
1790+
1791+PATH=/sbin:/bin:/usr/sbin:/usr/bin
1792+DAEMON=/usr/sbin/ietd
1793+OPTIONS=""
1794+PIDFILE=/var/run/iscsi_trgt.pid
1795+
1796+if [ -f /lib/init/vars.sh ]; then
1797+ . /lib/init/vars.sh
1798+fi
1799+
1800+if [ -f /lib/lsb/init-functions ]; then
1801+ . /lib/lsb/init-functions
1802+fi
1803+
1804+if [ -f /etc/sysconfig/iscsi-target ]; then
1805+ . /etc/sysconfig/iscsi-target
1806+fi
1807+
1808+RETVAL=0
1809+
1810+ietd_start()
1811+{
1812+ log_daemon_msg "Starting iSCSI Target" "ietd"
1813+ modprobe -q crc32c
1814+ modprobe iscsi_trgt
1815+ start-stop-daemon --start --exec $DAEMON --pidfile $PIDFILE -- $OPTIONS
1816+ log_end_msg $?
1817+}
1818+
1819+ietd_stop()
1820+{
1821+ log_daemon_msg "Stopping iSCSI Target" "ietd"
1822+ ietadm --op delete
1823+ start-stop-daemon --stop --exec $DAEMON --pidfile $PIDFILE
1824+ rm -f $PIDFILE
1825+ log_end_msg $?
1826+}
1827+
1828+ietd_status()
1829+{
1830+ PID=`pidof ietd`
1831+ if [ $PID ]; then
1832+ echo "iSCSI Target (pid $PID) is running..."
1833+ else
1834+ echo "iSCSI Target is stopped."
1835+ exit 1
1836+ fi
1837+}
1838+
1839+case "$1" in
1840+ start)
1841+ ietd_start
1842+ ;;
1843+ stop)
1844+ ietd_stop
1845+ ;;
1846+ restart)
1847+ ietd_stop
1848+ sleep 1
1849+ ietd_start
1850+ ;;
1851+ status)
1852+ ietd_status
1853+ ;;
1854+ *)
1855+ echo $"Usage: $0 {start|stop|restart|status}"
1856+ exit 1
1857+esac
1858+
1859+exit 0
1860
1861=== added file '.pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo'
1862--- .pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo 1970-01-01 00:00:00 +0000
1863+++ .pc/debian-changes-1.4.20.2-5/etc/initd/initd.gentoo 2011-06-29 14:00:59 +0000
1864@@ -0,0 +1,39 @@
1865+#!/sbin/runscript
1866+#
1867+# Start the iSCSI Enterprise Target.
1868+#
1869+# To define start-up options, create a config file called
1870+# /etc/conf.d/iscsi-target, in it define OPTIONS="...".
1871+
1872+depend()
1873+{
1874+ use net
1875+ need localmount
1876+ after bootmisc
1877+}
1878+
1879+start()
1880+{
1881+ ebegin "Starting iSCSI Target"
1882+ modprobe -q crc32c
1883+ modprobe iscsi_trgt
1884+ start-stop-daemon --start --exec /usr/sbin/ietd --pidfile /var/run/iscsi_trgt.pid -- $OPTIONS
1885+ eend $?
1886+}
1887+
1888+stop()
1889+{
1890+ ebegin "Stopping iSCSI Target"
1891+ ietadm --op delete
1892+ start-stop-daemon --stop --exec /usr/sbin/ietd --pidfile /var/run/iscsi_trgt.pid
1893+ rm -f /var/run/iscsi_trgt.pid
1894+ eend $?
1895+}
1896+
1897+restart()
1898+{
1899+ stop
1900+ sleep 1
1901+ start
1902+}
1903+
1904
1905=== added directory '.pc/debian-changes-1.4.20.2-5/include'
1906=== added file '.pc/debian-changes-1.4.20.2-5/include/iet_u.h'
1907--- .pc/debian-changes-1.4.20.2-5/include/iet_u.h 1970-01-01 00:00:00 +0000
1908+++ .pc/debian-changes-1.4.20.2-5/include/iet_u.h 2011-06-29 14:00:59 +0000
1909@@ -0,0 +1,151 @@
1910+#ifndef _IET_U_H
1911+#define _IET_U_H
1912+
1913+#define IET_VERSION_STRING "1.4.20.2"
1914+
1915+/* The maximum length of 223 bytes in the RFC. */
1916+#define ISCSI_NAME_LEN 256
1917+#define ISCSI_ARGS_LEN 2048
1918+
1919+#define ISCSI_LISTEN_PORT 3260
1920+
1921+#define SCSI_ID_LEN 16
1922+#define SCSI_SN_LEN (SCSI_ID_LEN * 2)
1923+
1924+#ifndef aligned_u64
1925+#define aligned_u64 unsigned long long __attribute__((aligned(8)))
1926+#endif
1927+
1928+struct module_info {
1929+ char version[128];
1930+};
1931+
1932+struct target_info {
1933+ u32 tid;
1934+ char name[ISCSI_NAME_LEN];
1935+};
1936+
1937+struct volume_info {
1938+ u32 tid;
1939+ u32 lun;
1940+ aligned_u64 args_ptr;
1941+ u32 args_len;
1942+};
1943+
1944+struct session_info {
1945+ u32 tid;
1946+
1947+ aligned_u64 sid;
1948+ char initiator_name[ISCSI_NAME_LEN];
1949+ u32 exp_cmd_sn;
1950+ u32 max_cmd_sn;
1951+};
1952+
1953+#define DIGEST_ALL (DIGEST_NONE | DIGEST_CRC32C)
1954+#define DIGEST_NONE (1 << 0)
1955+#define DIGEST_CRC32C (1 << 1)
1956+
1957+struct conn_info {
1958+ u32 tid;
1959+ aligned_u64 sid;
1960+
1961+ u32 cid;
1962+ u32 stat_sn;
1963+ u32 exp_stat_sn;
1964+ int header_digest;
1965+ int data_digest;
1966+ int fd;
1967+};
1968+
1969+enum {
1970+ key_initial_r2t,
1971+ key_immediate_data,
1972+ key_max_connections,
1973+ key_max_recv_data_length,
1974+ key_max_xmit_data_length,
1975+ key_max_burst_length,
1976+ key_first_burst_length,
1977+ key_default_wait_time,
1978+ key_default_retain_time,
1979+ key_max_outstanding_r2t,
1980+ key_data_pdu_inorder,
1981+ key_data_sequence_inorder,
1982+ key_error_recovery_level,
1983+ key_header_digest,
1984+ key_data_digest,
1985+ key_ofmarker,
1986+ key_ifmarker,
1987+ key_ofmarkint,
1988+ key_ifmarkint,
1989+ session_key_last,
1990+};
1991+
1992+enum {
1993+ key_wthreads,
1994+ key_target_type,
1995+ key_queued_cmnds,
1996+ key_nop_interval,
1997+ key_nop_timeout,
1998+ target_key_last,
1999+};
2000+
2001+enum {
2002+ key_session,
2003+ key_target,
2004+};
2005+
2006+struct iscsi_param_info {
2007+ u32 tid;
2008+ aligned_u64 sid;
2009+
2010+ u32 param_type;
2011+ u32 partial;
2012+
2013+ u32 session_param[session_key_last];
2014+ u32 target_param[target_key_last];
2015+};
2016+
2017+enum iet_event_state {
2018+ E_CONN_CLOSE,
2019+};
2020+
2021+struct iet_event {
2022+ u32 tid;
2023+ aligned_u64 sid;
2024+ u32 cid;
2025+ u32 state;
2026+};
2027+
2028+#define DEFAULT_NR_WTHREADS 8
2029+#define MIN_NR_WTHREADS 1
2030+#define MAX_NR_WTHREADS 128
2031+
2032+#define DEFAULT_NR_QUEUED_CMNDS 32
2033+#define MIN_NR_QUEUED_CMNDS 1
2034+#define MAX_NR_QUEUED_CMNDS 256
2035+
2036+#define DEFAULT_NOP_INTERVAL 0
2037+#define MIN_NOP_INTERVAL 0
2038+#define MAX_NOP_INTERVAL 90
2039+
2040+#define DEFAULT_NOP_TIMEOUT 0
2041+#define MIN_NOP_TIMEOUT 0
2042+#define MAX_NOP_TIMEOUT 90
2043+
2044+#define NETLINK_IET 21
2045+
2046+#define GET_MODULE_INFO _IOW('i', 20, struct module_info)
2047+#define ADD_TARGET _IOWR('i', 21, struct target_info)
2048+#define DEL_TARGET _IOW('i', 22, struct target_info)
2049+#define ADD_VOLUME _IOW('i', 24, struct volume_info)
2050+#define DEL_VOLUME _IOW('i', 25, struct volume_info)
2051+#define ADD_SESSION _IOW('i', 26, struct session_info)
2052+#define DEL_SESSION _IOW('i', 27, struct session_info)
2053+#define GET_SESSION_INFO _IOWR('i', 28, struct session_info)
2054+#define ADD_CONN _IOW('i', 29, struct conn_info)
2055+#define DEL_CONN _IOW('i', 30, struct conn_info)
2056+#define GET_CONN_INFO _IOWR('i', 31, struct conn_info)
2057+#define ISCSI_PARAM_SET _IOW('i', 32, struct iscsi_param_info)
2058+#define ISCSI_PARAM_GET _IOWR('i', 33, struct iscsi_param_info)
2059+
2060+#endif
2061
2062=== added file '.pc/debian-changes-1.4.20.2-5/iscsitarget.spec'
2063--- .pc/debian-changes-1.4.20.2-5/iscsitarget.spec 1970-01-01 00:00:00 +0000
2064+++ .pc/debian-changes-1.4.20.2-5/iscsitarget.spec 2011-06-29 14:00:59 +0000
2065@@ -0,0 +1,507 @@
2066+##
2067+## Global Package Definitions
2068+##
2069+
2070+## IET Release
2071+%define iet_version 1.4.20.2
2072+
2073+## Package Revision
2074+%define revision 1
2075+
2076+## Build Options (modify to tune your build)
2077+# Build DKMS kernel module
2078+#
2079+# Two passes through rpmbuild are required, once for the userland
2080+# binary package and another time with --target=noarch for the
2081+# kernel dkms package.
2082+%define dkms 0
2083+
2084+# Build weak modules (KABI tracking) if supported
2085+#
2086+# If it isn't supported it will figure that out below
2087+%define weak 1
2088+
2089+# Build from SVN repository
2090+%define svn 0
2091+%define svn_rev HEAD
2092+%define svn_repo https://iscsitarget.svn.sourceforge.net/svnroot/iscsitarget
2093+
2094+## Platform Definitions (you shouldn't need to modify these)
2095+# Determine distribution
2096+%define is_suse !%(test -e /etc/SuSE-release; echo $?)
2097+%define is_fedora !%(test -e /etc/fedora-release; echo $?)
2098+%define is_redhat !%(test -e /etc/redhat-release; echo $?)
2099+%define is_mandrake !%(test -e /etc/mandrake-release; echo $?)
2100+%define is_mandriva !%(test -e /etc/mandriva-release; echo $?)
2101+
2102+# Define kernel version information
2103+%{!?kernel: %define kernel %(uname -r)}
2104+
2105+%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/-$//')
2106+%define krel %(echo %{kver} | sed -e 's/-/_/g')
2107+%define ktype %(echo kernel-%{kernel} | sed -e 's/%{kver}//' -e 's/--/-/' -e 's/-$//')
2108+
2109+%define moddir /lib/modules/%{kernel}
2110+
2111+# Set location of tools
2112+%{!?__chkconfig: %define __chkconfig /sbin/chkconfig}
2113+%{!?__depmod: %define __depmod /sbin/depmod}
2114+%{!?__dkms: %define __dkms /usr/sbin/dkms}
2115+%{!?__find: %define __find /usr/bin/find}
2116+%{!?__modprobe: %define __modprobe /sbin/modprobe}
2117+%{!?__service: %define __service /sbin/service}
2118+%{!?__svn: %define __svn /usr/bin/svn}
2119+%if %is_suse
2120+%{!?__weak_modules: %define __weak_modules /usr/lib/module-init-tools/weak-modules}
2121+%else
2122+%{!?__weak_modules: %define __weak_modules /sbin/weak-modules}
2123+%endif
2124+
2125+# Subversion build information
2126+%if %svn
2127+%if !%(test "%{iet_version}" = "trunk"; echo $?)
2128+%define svn_url %{svn_repo}/trunk
2129+%define svn_ver %(%{__svn} info -r %{svn_rev} --non-interactive %{svn_url} | awk '{if ($1 == "Revision:") {print "r"$2}}')
2130+%else
2131+%define svn_url %{svn_repo}/tags/%{iet_version}
2132+%endif
2133+%endif
2134+
2135+# Build weak module (KABI Tracking) on platforms that support it
2136+%if %weak
2137+%define weak !%(test -x %{__weak_modules}; echo $?)
2138+%endif
2139+
2140+# Basic regex filters for unwanted dependencies (used for weak modules)
2141+%if %weak
2142+%define pro_filter ""
2143+%if %is_redhat
2144+%define req_filter "\\(fsync_bdev\\|sync_page_range\\|vfs_write\\|get_io_context\\|copy_io_context\\|put_io_context\\)"
2145+%else
2146+%define req_filter ""
2147+%endif
2148+%endif
2149+
2150+# Define build user
2151+%define user %(whoami)
2152+
2153+
2154+##
2155+## Userland Package
2156+##
2157+
2158+## Information
2159+Summary: iSCSI Enterprise Target
2160+Name: iscsitarget
2161+Version: %{?svn_ver: %{iet_version}_%{svn_ver}}%{!?svn_ver: %{iet_version}}
2162+Release: %{?revision: %{revision}}%{!?revision: 1}
2163+License: GPL
2164+Group: System Environment/Daemons
2165+URL: http://sourceforge.net/projects/iscsitarget/
2166+Packager: IET development team <iscsitarget-devel@lists.sourceforge.net>
2167+
2168+## Source files
2169+%if !%svn
2170+Source0: %{name}-%{version}.tar.gz
2171+%endif
2172+
2173+## Patches
2174+#Patch0: %{name}-%{version}-example.p
2175+
2176+## Install Requirements
2177+Requires: %{name}-kmod = %{version}
2178+
2179+## Build Requirements
2180+BuildRequires: kernel >= 2.6
2181+BuildRequires: gcc, make, patch, binutils, /usr/bin/install, openssl-devel
2182+%if %is_suse
2183+BuildRequires: kernel-source = %{kver}
2184+%else
2185+BuildRequires: %{ktype}-devel = %{kver}
2186+%endif
2187+%if %svn
2188+BuildRequires: subversion
2189+%endif
2190+
2191+## Build Definitions
2192+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{user}
2193+
2194+## Description
2195+%description
2196+iSCSI Enterprise Target
2197+
2198+
2199+##
2200+## Kernel Module Package
2201+##
2202+%if %dkms
2203+%ifarch noarch
2204+%package -n dkms-%{name}
2205+
2206+## Information
2207+Summary: iSCSI Enterprise Target kernel module
2208+Group: System Environment/Kernel
2209+Release: %{release}
2210+
2211+## Install Requirements
2212+Requires: dkms >= 2, gcc, make, patch, binutils
2213+%if %is_suse
2214+Requires: kernel-source
2215+%else
2216+Requires: %{ktype}-devel
2217+%endif
2218+
2219+## Install Provides
2220+Provides: kernel-modules
2221+Provides: %{name}-kmod = %{version}
2222+
2223+## Install Conflicts
2224+Conflicts: kmod-%{name}
2225+
2226+## Description
2227+%description -n dkms-%{name}
2228+iSCSI Enterprise Target kernel module
2229+%endif
2230+%else
2231+%package -n kmod-%{name}
2232+
2233+## Information
2234+Summary: iSCSI Enterprise Target kernel module
2235+Group: System Environment/Kernel
2236+Release: %{release}_%{krel}
2237+
2238+## Install Requirements
2239+%if %weak
2240+Requires: %{ktype}
2241+Requires(post): %{__weak_modules}
2242+Requires(postun): %{__weak_modules}
2243+%else
2244+Requires: %{ktype} = %{kver}
2245+%endif
2246+Requires(post): %{__depmod}
2247+Requires(postun): %{__depmod}
2248+
2249+## Install Provides
2250+%if !%weak
2251+Provides: kernel-modules = %{kver}
2252+%endif
2253+Provides: %{name}-kmod = %{version}
2254+
2255+## Install Conflicts
2256+Conflicts: dkms-%{name}
2257+
2258+## Description
2259+%description -n kmod-%{name}
2260+iSCSI Enterprise Target kernel module
2261+%endif
2262+
2263+
2264+##
2265+## Package Creation
2266+##
2267+
2268+## Preparation
2269+%prep
2270+
2271+
2272+## Setup
2273+%if %svn
2274+%setup -q -D -T -c -n %{name}-%{version}
2275+if [ ! -f include/iet_u.h ]; then
2276+%{__svn} export --force -r %{svn_rev} --non-interactive -q %{svn_url} .
2277+%{__sed} -i -e "s/\(#define IET_VERSION_STRING\).*/\1\t\"%{version}\"/" include/iet_u.h
2278+# Patches to apply to SVN
2279+#%patch0 -p0
2280+fi
2281+%else
2282+%setup -q -n %{name}-%{version}
2283+# Patches to apply to release
2284+#%patch0 -p0
2285+%endif
2286+
2287+
2288+## Build
2289+%build
2290+%{__make} distclean
2291+%ifnarch noarch
2292+%if %dkms
2293+%{__make} usr
2294+%else
2295+%{__make}
2296+%endif
2297+%endif
2298+
2299+
2300+## Installation
2301+%install
2302+%{__rm} -rf %{buildroot}
2303+
2304+%ifnarch noarch
2305+%if %dkms
2306+%{__make} install-usr install-doc install-etc DISTDIR=%{buildroot} DESTDIR=%{buildroot}
2307+%else
2308+%{__make} install-usr install-doc install-etc install-kernel DISTDIR=%{buildroot} DESTDIR=%{buildroot}
2309+%{__rm} -f %{buildroot}/lib/modules/%{kernel}/modules.*
2310+%if !%(test -d %{buildroot}%{moddir}/extra/iscsi; echo $?)
2311+%define module %{moddir}/extra/iscsi/iscsi_trgt.ko
2312+%else
2313+%define module %{moddir}/kernel/iscsi/iscsi_trgt.ko
2314+%endif
2315+%endif
2316+%if %is_redhat || %is_fedora
2317+if [ -d %{buildroot}/etc/init.d ]; then
2318+ %{__mkdir} %{buildroot}/etc/rc.d
2319+ %{__mv} %{buildroot}/etc/init.d %{buildroot}/etc/rc.d
2320+fi
2321+%endif
2322+%if %(test -d %{buildroot}/etc/iet; echo $?)
2323+%define ietd_conf %{_sysconfdir}/iet/ietd.conf
2324+%define initiators_allow %{_sysconfdir}/iet/initiators.allow
2325+%define targets_allow %{_sysconfdir}/iet/targets.allow
2326+%else
2327+%define ietd_conf %{_sysconfdir}/ietd.conf
2328+%define initiators_allow %{_sysconfdir}/initiators.allow
2329+%define targets_allow %{_sysconfdir}/initiators.deny
2330+%endif
2331+%elseif %dkms
2332+%{__mkdir} -p %{buildroot}/usr/src/%{name}-%{version}
2333+%{__cp} -r COPYING dkms.conf include kernel patches %{buildroot}/usr/src/%{name}-%{version}
2334+%{__sed} -i -e "s/\(PACKAGE_VERSION=\).*/\1\"%{version}\"/" %{buildroot}/usr/src/%{name}-%{version}/dkms.conf
2335+%endif
2336+
2337+# Ugly hack to filter out unwanted dependencies
2338+%if %weak
2339+%global _use_internal_dependency_generator 0
2340+%if !%(test -n "%{pro_filter}"; echo $?)
2341+%define iet_provides %{_tmppath}/iet_provides-%{user}
2342+%{__cat} << EOF > %{iet_provides}
2343+%{__find_provides} "\$@" | %{__grep} -v %{pro_filter}
2344+exit 0
2345+EOF
2346+%{__chmod} 755 %{iet_provides}
2347+%define __find_provides %{iet_provides}
2348+%endif
2349+%if !%(test -n "%{req_filter}"; echo $?)
2350+%define iet_requires %{_tmppath}/iet_requires-%{user}
2351+%{__cat} << EOF > %{iet_requires}
2352+%{__find_requires} "\$@" | %{__grep} -v %{req_filter}
2353+exit 0
2354+EOF
2355+%{__chmod} 755 %{iet_requires}
2356+%define __find_requires %{iet_requires}
2357+%endif
2358+%endif
2359+
2360+
2361+## Cleaning
2362+%clean
2363+%{__rm} -rf %{buildroot}
2364+%if %{?iet_provides:1}%{!?iet_provides:0}
2365+%{__rm} -f %{iet_provides}
2366+%endif
2367+%if %{?iet_requires:1}%{!?iet_requires:0}
2368+%{__rm} -f %{iet_requires}
2369+%endif
2370+
2371+
2372+## Post-Install Script
2373+%ifnarch noarch
2374+%post
2375+%if %is_suse
2376+%{__ln} -s %{_initrddir}/iscsi-target %{_sbindir}/rciscsi-target
2377+%endif
2378+%{__chkconfig} --add iscsi-target
2379+%endif
2380+
2381+
2382+## Pre-Uninstall Script
2383+%ifnarch noarch
2384+%preun
2385+if [ "$1" = 0 ]; then
2386+ %{__service} iscsi-target stop &>/dev/null
2387+ %{__chkconfig} --del iscsi-target &>/dev/null
2388+fi
2389+%if %is_suse
2390+%{__rm} -f %{_sbindir}/rciscsi-target
2391+%endif
2392+%endif
2393+
2394+
2395+## Post-Uninstall Script
2396+%ifnarch noarch
2397+%postun
2398+if [ "$1" != 0 ]; then
2399+ %{__service} iscsi-target condrestart &>/dev/null
2400+fi
2401+%endif
2402+
2403+
2404+## Post-Install Script (Kernel Module)
2405+%if %dkms
2406+%ifarch noarch
2407+%post -n dkms-%{name}
2408+%{__dkms} add -m %{name} -v %{version} --rpm_safe_upgrade
2409+%{__dkms} build -m %{name} -v %{version}
2410+%{__dkms} install -m %{name} -v %{version} --force
2411+%endif
2412+%else
2413+%post -n kmod-%{name}
2414+%{__depmod} %{kernel} -a
2415+%if %weak
2416+if [ -x %{__weak_modules} ]; then
2417+ echo %{module} | %{__weak_modules} --add-modules
2418+fi
2419+%endif
2420+%endif
2421+
2422+
2423+## Pre-Uninstall Script (Kernel Module)
2424+%if %dkms
2425+%ifarch noarch
2426+%preun -n dkms-%{name}
2427+%{__dkms} remove -m %{name} -v %{version} --all --rpm_safe_upgrade
2428+%endif
2429+%else
2430+%preun -n kmod-%{name}
2431+%{__modprobe} -r -q --set-version %{kernel} iscsi_trgt
2432+%if %weak
2433+if [ -x %{__weak_modules} ]; then
2434+ echo %{module} | %{__weak_modules} --remove-modules
2435+fi
2436+%endif
2437+%endif
2438+
2439+
2440+## Post-Uninstall Script (Kernel Module)
2441+%if !%dkms
2442+%postun -n kmod-%{name}
2443+%{__depmod} %{kernel} -a
2444+%endif
2445+
2446+
2447+## File Catalog
2448+%ifnarch noarch
2449+%files
2450+%defattr(-, root, root)
2451+%{_sbindir}
2452+%{_mandir}/man?
2453+%{_initrddir}
2454+%config(noreplace) %{ietd_conf}
2455+%config(noreplace) %{initiators_allow}
2456+%config(noreplace) %{targets_allow}
2457+%doc %{_docdir}
2458+%endif
2459+
2460+
2461+## File Catalog (Kernel Module)
2462+%if %dkms
2463+%ifarch noarch
2464+%files -n dkms-%{name}
2465+%defattr(-, root, root)
2466+/usr/src/%{name}-%{version}
2467+%endif
2468+%else
2469+%files -n kmod-%{name}
2470+%defattr(-, root, root)
2471+/lib/modules/%{kernel}
2472+%endif
2473+
2474+
2475+%changelog
2476+* Tue May 11 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20.2
2477+- fixed recursive KERNELSRC define problem on SLES
2478+- updated SVN building to handle tagged builds
2479+- updated iet_version for next release
2480+- fixed install and file catalogs to work with previous versions
2481+
2482+* Tue Mar 30 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20
2483+- Changed DKMS module name to dkms-iscsitarget from kmod-iscsitarget
2484+- Added Provides: kernel-modules to DKMS module so multiple versions can
2485+ be managed by DKMS at once.
2486+- Added conflicts to dkms and kmod for each other so only one type can
2487+ be installed at a time.
2488+- Added --rpm_safe_upgrade to DKMS add/remove for RPM-DKMS sync
2489+- Added --force to DKMS install in case version changed, but code didn't
2490+
2491+* Mon Mar 29 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.20
2492+- Updated SVN build defines.
2493+- Added weak build define to manually choose KABI tracking or per-kernel
2494+- Fixed issue with upgrading KABI tracking module by removing
2495+ Provides: kernel-modules to weak builds, kept for per-kernel builds
2496+ if you install weak built module, all per-kernels are uninstalled,
2497+ you cannot install a per-kernel while a weak built is installed.
2498+
2499+* Mon Mar 08 2010 Ross Walker <rswwalker at gmail dot com> - 1.4.19
2500+- removed openssl-devel build requirement
2501+
2502+* Wed Oct 14 2009 Ross Walker <rswwalker at gmail dot com> - 1.4.18
2503+- Added more macros for better cross-distro support
2504+- Modified Matt's update for better Redhat-SuSE compatibility
2505+
2506+* Fri Oct 09 2009 Matthew Wild <matthew.wild at stfc dot ac dot uk> - 1.4.18
2507+- Added openSuSE specific configuration
2508+- Tidied up files section for init.d|rc.d
2509+- run depmod with -a rather than -A option
2510+
2511+* Wed Sep 25 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-244
2512+- SuSE puts weak-modules under /usr/lib/module-init-tools
2513+- Kernel module now located in /lib/modules/<kernel>/extra/iscsi
2514+
2515+* Wed Sep 25 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-242
2516+- Added ability to build weak modules for platforms that support them
2517+- Cleaned up logic a little
2518+- Made safe for multi-user builds
2519+- Redacted old spec file maintainer's email address
2520+
2521+* Wed Sep 22 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-236
2522+- Updated file catalog for new config directory
2523+
2524+* Wed Sep 09 2009 Ross Walker <rswwalker at gmail dot com> - 0.4.17-226
2525+- Added ability to build directly from subversion repo
2526+- Added ability to build dkms kernel module
2527+
2528+* Mon Nov 10 2008 Ross Walker <rswwalker at gmail dot com> - 0.4.17-177
2529+- Changed kernel-module naming to kmod
2530+- Updated versioning
2531+
2532+* Fri Feb 16 2007 Ross Walker <rswwalker at gmail dot com> - 0.4.14-96
2533+- Reworked spec file for latest release
2534+- Commented and cleaned up sections
2535+- Added additional documents to %files
2536+
2537+* Mon Nov 21 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1266.1
2538+- upstream snapshot 1266
2539+- added condrestart patch
2540+- stop and start service on update or removal
2541+
2542+* Sun Nov 13 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1264.2
2543+- run %post and %preun for kernel package, not main package
2544+
2545+* Sun Nov 13 2005 Bastiaan Bakker <redacted> - 0.4.13-0.1264.1
2546+- updated to snapshot 1264
2547+
2548+* Thu Nov 03 2005 Bastiaan Bakker <redacted> - 0.4.12-6
2549+- added openssl-devel build requirement
2550+- removed '.ko' extension in modprobe command
2551+
2552+* Wed Nov 02 2005 Bastiaan Bakker <redacted> - 0.4.12-5
2553+- fixed kernel-devel BuildRequires
2554+
2555+* Fri Sep 23 2005 Bastiaan Bakker <redacted> - 0.4.12-4
2556+- fixed modprobe -r 'FATAL' message
2557+- run depmod with correct kernel version
2558+
2559+* Fri Sep 23 2005 Bastiaan Bakker <redacted> - 0.4.12-3
2560+- added config files
2561+- set kernel module file permissions to 744
2562+- fixed provides/requires of kernel module
2563+- removed BuildArch restriction
2564+
2565+* Thu Sep 22 2005 Bastiaan Bakker <redacted> - 0.4.12-2
2566+- create separate subpackage for kernel module
2567+- include man pages
2568+- added kernel compatibility patch for kernels < 2.6.11
2569+
2570+* Wed Aug 03 2005 Bastiaan Bakker <redacted>
2571+- First version.
2572+
2573
2574=== added directory '.pc/debian-changes-1.4.20.2-5/kernel'
2575=== added file '.pc/debian-changes-1.4.20.2-5/kernel/block-io.c'
2576--- .pc/debian-changes-1.4.20.2-5/kernel/block-io.c 1970-01-01 00:00:00 +0000
2577+++ .pc/debian-changes-1.4.20.2-5/kernel/block-io.c 2011-06-29 14:00:59 +0000
2578@@ -0,0 +1,327 @@
2579+/*
2580+ * Target device block I/O.
2581+ *
2582+ * Based on file I/O driver from FUJITA Tomonori
2583+ * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
2584+ * (C) 2006 Andre Brinkmann <brinkman at hni dot upb dot de>
2585+ * (C) 2007 Ross Walker <rswwalker at hotmail dot com>
2586+ * (C) 2007 Ming Zhang <blackmagic02881 at gmail dot com>
2587+ * This code is licenced under the GPL.
2588+ */
2589+
2590+#include <linux/types.h>
2591+#include <linux/blkdev.h>
2592+#include <linux/parser.h>
2593+#include <linux/buffer_head.h>
2594+
2595+#include "iscsi.h"
2596+#include "iscsi_dbg.h"
2597+#include "iotype.h"
2598+
2599+struct blockio_data {
2600+ char *path;
2601+ struct block_device *bdev;
2602+};
2603+
2604+struct tio_work {
2605+ atomic_t error;
2606+ atomic_t bios_remaining;
2607+ struct completion tio_complete;
2608+};
2609+
2610+static void blockio_bio_endio(struct bio *bio, int error)
2611+{
2612+ struct tio_work *tio_work = bio->bi_private;
2613+
2614+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
2615+
2616+ if (error)
2617+ atomic_set(&tio_work->error, error);
2618+
2619+ /* If last bio signal completion */
2620+ if (atomic_dec_and_test(&tio_work->bios_remaining))
2621+ complete(&tio_work->tio_complete);
2622+
2623+ bio_put(bio);
2624+}
2625+
2626+/*
2627+ * Blockio_make_request(): The function translates an iscsi-request into
2628+ * a number of requests to the corresponding block device.
2629+ */
2630+static int
2631+blockio_make_request(struct iet_volume *volume, struct tio *tio, int rw)
2632+{
2633+ struct blockio_data *bio_data = volume->private;
2634+ struct request_queue *bdev_q = bdev_get_queue(bio_data->bdev);
2635+ struct tio_work *tio_work;
2636+ struct bio *tio_bio = NULL, *bio = NULL, *biotail = NULL;
2637+
2638+ u32 offset = tio->offset;
2639+ u32 size = tio->size;
2640+ u32 tio_index = 0;
2641+
2642+ int max_pages = 1;
2643+ int err = 0;
2644+
2645+ loff_t ppos = ((loff_t) tio->idx << PAGE_SHIFT) + offset;
2646+
2647+ /* Calculate max_pages for bio_alloc (memory saver) */
2648+ if (bdev_q)
2649+ max_pages = bio_get_nr_vecs(bio_data->bdev);
2650+
2651+ tio_work = kzalloc(sizeof (*tio_work), GFP_KERNEL);
2652+ if (!tio_work)
2653+ return -ENOMEM;
2654+
2655+ atomic_set(&tio_work->error, 0);
2656+ atomic_set(&tio_work->bios_remaining, 0);
2657+ init_completion(&tio_work->tio_complete);
2658+
2659+ /* Main processing loop, allocate and fill all bios */
2660+ while (tio_index < tio->pg_cnt) {
2661+ bio = bio_alloc(GFP_KERNEL, min(max_pages, BIO_MAX_PAGES));
2662+ if (!bio) {
2663+ err = -ENOMEM;
2664+ goto out;
2665+ }
2666+
2667+ /* bi_sector is ALWAYS in units of 512 bytes */
2668+ bio->bi_sector = ppos >> 9;
2669+ bio->bi_bdev = bio_data->bdev;
2670+ bio->bi_end_io = blockio_bio_endio;
2671+ bio->bi_private = tio_work;
2672+
2673+ if (tio_bio)
2674+ biotail = biotail->bi_next = bio;
2675+ else
2676+ tio_bio = biotail = bio;
2677+
2678+ atomic_inc(&tio_work->bios_remaining);
2679+
2680+ /* Loop for filling bio */
2681+ while (tio_index < tio->pg_cnt) {
2682+ unsigned int bytes = PAGE_SIZE - offset;
2683+
2684+ if (bytes > size)
2685+ bytes = size;
2686+
2687+ if (!bio_add_page(bio, tio->pvec[tio_index], bytes, offset))
2688+ break;
2689+
2690+ size -= bytes;
2691+ ppos += bytes;
2692+
2693+ offset = 0;
2694+
2695+ tio_index++;
2696+ }
2697+ }
2698+
2699+ /* Walk the list, submitting bios 1 by 1 */
2700+ while (tio_bio) {
2701+ bio = tio_bio;
2702+ tio_bio = tio_bio->bi_next;
2703+ bio->bi_next = NULL;
2704+
2705+ submit_bio(rw, bio);
2706+ }
2707+
2708+ if (bdev_q && bdev_q->unplug_fn)
2709+ bdev_q->unplug_fn(bdev_q);
2710+
2711+ wait_for_completion(&tio_work->tio_complete);
2712+
2713+ err = atomic_read(&tio_work->error);
2714+
2715+ kfree(tio_work);
2716+
2717+ return err;
2718+out:
2719+ while (tio_bio) {
2720+ bio = tio_bio;
2721+ tio_bio = tio_bio->bi_next;
2722+
2723+ bio_put(bio);
2724+ }
2725+
2726+ kfree(tio_work);
2727+
2728+ return err;
2729+}
2730+
2731+static int
2732+blockio_open_path(struct iet_volume *volume, const char *path)
2733+{
2734+ struct blockio_data *bio_data = volume->private;
2735+ struct block_device *bdev;
2736+ int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
2737+ int err = 0;
2738+
2739+ bio_data->path = kstrdup(path, GFP_KERNEL);
2740+ if (!bio_data->path)
2741+ return -ENOMEM;
2742+
2743+ bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
2744+ if (IS_ERR(bdev)) {
2745+ err = PTR_ERR(bdev);
2746+ eprintk("Can't open device %s, error %d\n", path, err);
2747+ bio_data->bdev = NULL;
2748+ } else {
2749+ bio_data->bdev = bdev;
2750+ fsync_bdev(bio_data->bdev);
2751+ }
2752+
2753+ return err;
2754+}
2755+
2756+/* Create an enumeration of our accepted actions */
2757+enum
2758+{
2759+ opt_path, opt_ignore, opt_err,
2760+};
2761+
2762+/* Create a match table using our action enums and their matching options */
2763+static match_table_t tokens = {
2764+ {opt_path, "path=%s"},
2765+ {opt_ignore, "scsiid=%s"},
2766+ {opt_ignore, "scsisn=%s"},
2767+ {opt_ignore, "type=%s"},
2768+ {opt_ignore, "iomode=%s"},
2769+ {opt_ignore, "blocksize=%s"},
2770+ {opt_err, NULL},
2771+};
2772+
2773+static int
2774+parse_blockio_params(struct iet_volume *volume, char *params)
2775+{
2776+ struct blockio_data *info = volume->private;
2777+ int err = 0;
2778+ char *p, *q;
2779+
2780+ /* Loop through parameters separated by commas, look up our
2781+ * parameter in match table, return enumeration and arguments
2782+ * select case based on the returned enum and run the action */
2783+ while ((p = strsep(&params, ",")) != NULL) {
2784+ substring_t args[MAX_OPT_ARGS];
2785+ int token;
2786+ if (!*p)
2787+ continue;
2788+ iet_strtolower(p);
2789+ token = match_token(p, tokens, args);
2790+ switch (token) {
2791+ case opt_path:
2792+ if (info->path) {
2793+ iprintk("Target %s, LUN %u: "
2794+ "duplicate \"Path\" param\n",
2795+ volume->target->name, volume->lun);
2796+ err = -EINVAL;
2797+ goto out;
2798+ }
2799+ if (!(q = match_strdup(&args[0]))) {
2800+ err = -ENOMEM;
2801+ goto out;
2802+ }
2803+ err = blockio_open_path(volume, q);
2804+ kfree(q);
2805+ if (err < 0)
2806+ goto out;
2807+ break;
2808+ case opt_ignore:
2809+ break;
2810+ default:
2811+ iprintk("Target %s, LUN %u: unknown param %s\n",
2812+ volume->target->name, volume->lun, p);
2813+ return -EINVAL;
2814+ }
2815+ }
2816+
2817+ if (!info->path) {
2818+ iprintk("Target %s, LUN %u: missing \"Path\" param\n",
2819+ volume->target->name, volume->lun);
2820+ err = -EINVAL;
2821+ }
2822+
2823+ out:
2824+ return err;
2825+}
2826+
2827+static void
2828+blockio_detach(struct iet_volume *volume)
2829+{
2830+ struct blockio_data *bio_data = volume->private;
2831+ int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
2832+
2833+ if (bio_data->bdev)
2834+ close_bdev_exclusive(bio_data->bdev, flags);
2835+ kfree(bio_data->path);
2836+
2837+ kfree(volume->private);
2838+}
2839+
2840+static int
2841+blockio_attach(struct iet_volume *volume, char *args)
2842+{
2843+ struct blockio_data *bio_data;
2844+ int err = 0;
2845+
2846+ if (volume->private) {
2847+ eprintk("Lun %u already attached on Target %s \n",
2848+ volume->lun, volume->target->name);
2849+ return -EBUSY;
2850+ }
2851+
2852+ bio_data = kzalloc(sizeof (*bio_data), GFP_KERNEL);
2853+ if (!bio_data)
2854+ return -ENOMEM;
2855+
2856+ volume->private = bio_data;
2857+
2858+ err = parse_blockio_params(volume, args);
2859+ if (!err) {
2860+ /* see Documentation/ABI/testing/sysfs-block */
2861+ unsigned bsz = bdev_logical_block_size(bio_data->bdev);
2862+ if (!volume->blk_shift)
2863+ volume->blk_shift = blksize_bits(bsz);
2864+ else if (volume->blk_shift < blksize_bits(bsz)) {
2865+ eprintk("Specified block size (%u) smaller than "
2866+ "device %s logical block size (%u)\n",
2867+ (1 << volume->blk_shift), bio_data->path, bsz);
2868+ err = -EINVAL;
2869+ }
2870+ }
2871+ if (err < 0) {
2872+ eprintk("Error attaching Lun %u to Target %s \n",
2873+ volume->lun, volume->target->name);
2874+ goto out;
2875+ }
2876+
2877+ volume->blk_cnt = bio_data->bdev->bd_inode->i_size >> volume->blk_shift;
2878+
2879+ /* Offer neither write nor read caching */
2880+ ClearLURCache(volume);
2881+ ClearLUWCache(volume);
2882+
2883+ out:
2884+ if (err < 0)
2885+ blockio_detach(volume);
2886+
2887+ return err;
2888+}
2889+
2890+static void
2891+blockio_show(struct iet_volume *volume, struct seq_file *seq)
2892+{
2893+ struct blockio_data *bio_data = volume->private;
2894+
2895+ /* Used to display blockio volume info in /proc/net/iet/volumes */
2896+ seq_printf(seq, " path:%s\n", bio_data->path);
2897+}
2898+
2899+struct iotype blockio = {
2900+ .name = "blockio",
2901+ .attach = blockio_attach,
2902+ .make_request = blockio_make_request,
2903+ .detach = blockio_detach,
2904+ .show = blockio_show,
2905+};
2906
2907=== added file '.pc/debian-changes-1.4.20.2-5/kernel/config.c'
2908--- .pc/debian-changes-1.4.20.2-5/kernel/config.c 1970-01-01 00:00:00 +0000
2909+++ .pc/debian-changes-1.4.20.2-5/kernel/config.c 2011-06-29 14:00:59 +0000
2910@@ -0,0 +1,362 @@
2911+/*
2912+ * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
2913+ *
2914+ * This code is licenced under the GPL.
2915+ */
2916+
2917+#include <linux/proc_fs.h>
2918+
2919+#include "iscsi.h"
2920+#include "iscsi_dbg.h"
2921+
2922+static DECLARE_MUTEX(ioctl_sem);
2923+
2924+struct proc_entries {
2925+ const char *name;
2926+ struct file_operations *fops;
2927+};
2928+
2929+static struct proc_entries iet_proc_entries[] =
2930+{
2931+ {"volume", &volume_seq_fops},
2932+ {"session", &session_seq_fops},
2933+};
2934+
2935+static struct proc_dir_entry *proc_iet_dir;
2936+
2937+void iet_procfs_exit(void)
2938+{
2939+ int i;
2940+
2941+ if (!proc_iet_dir)
2942+ return;
2943+
2944+ for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++)
2945+ remove_proc_entry(iet_proc_entries[i].name, proc_iet_dir);
2946+
2947+ remove_proc_entry(proc_iet_dir->name, proc_iet_dir->parent);
2948+}
2949+
2950+int iet_procfs_init(void)
2951+{
2952+ int i;
2953+ struct proc_dir_entry *ent;
2954+
2955+ if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
2956+ goto err;
2957+
2958+ for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++) {
2959+ ent = create_proc_entry(iet_proc_entries[i].name, 0, proc_iet_dir);
2960+ if (ent)
2961+ ent->proc_fops = iet_proc_entries[i].fops;
2962+ else
2963+ goto err;
2964+ }
2965+
2966+ return 0;
2967+
2968+err:
2969+ if (proc_iet_dir)
2970+ iet_procfs_exit();
2971+
2972+ return -ENOMEM;
2973+}
2974+
2975+static int get_module_info(unsigned long ptr)
2976+{
2977+ struct module_info info;
2978+ int err;
2979+
2980+ snprintf(info.version, sizeof(info.version), "%s", IET_VERSION_STRING);
2981+
2982+ err = copy_to_user((void *) ptr, &info, sizeof(info));
2983+ if (err)
2984+ return -EFAULT;
2985+
2986+ return 0;
2987+}
2988+
2989+static int get_conn_info(struct iscsi_target *target, unsigned long ptr)
2990+{
2991+ struct iscsi_session *session;
2992+ struct iscsi_conn *conn;
2993+ struct conn_info info;
2994+ int err;
2995+
2996+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
2997+ if (err)
2998+ return -EFAULT;
2999+
3000+ session = session_lookup(target, info.sid);
3001+ if (!session)
3002+ return -ENOENT;
3003+
3004+ conn = conn_lookup(session, info.cid);
3005+ if (!conn)
3006+ return -ENOENT;
3007+
3008+ info.cid = conn->cid;
3009+ info.stat_sn = conn->stat_sn;
3010+ info.exp_stat_sn = conn->exp_stat_sn;
3011+
3012+ err = copy_to_user((void *) ptr, &info, sizeof(info));
3013+ if (err)
3014+ return -EFAULT;
3015+
3016+ return 0;
3017+}
3018+
3019+static int add_conn(struct iscsi_target *target, unsigned long ptr)
3020+{
3021+ struct iscsi_session *session;
3022+ struct conn_info info;
3023+ int err;
3024+
3025+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3026+ if (err)
3027+ return -EFAULT;
3028+
3029+ session = session_lookup(target, info.sid);
3030+ if (!session)
3031+ return -ENOENT;
3032+
3033+ return conn_add(session, &info);
3034+}
3035+
3036+static int del_conn(struct iscsi_target *target, unsigned long ptr)
3037+{
3038+ struct iscsi_session *session;
3039+ struct conn_info info;
3040+ int err;
3041+
3042+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3043+ if (err)
3044+ return -EFAULT;
3045+
3046+ session = session_lookup(target, info.sid);
3047+ if (!session)
3048+ return -ENOENT;
3049+
3050+ return conn_del(session, &info);
3051+}
3052+
3053+static int get_session_info(struct iscsi_target *target, unsigned long ptr)
3054+{
3055+ struct iscsi_session *session;
3056+ struct session_info info;
3057+ int err;
3058+
3059+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3060+ if (err)
3061+ return -EFAULT;
3062+
3063+ session = session_lookup(target, info.sid);
3064+ if (!session)
3065+ return -ENOENT;
3066+
3067+ info.exp_cmd_sn = session->exp_cmd_sn;
3068+ info.max_cmd_sn = session->max_cmd_sn;
3069+
3070+ err = copy_to_user((void *) ptr, &info, sizeof(info));
3071+ if (err)
3072+ return -EFAULT;
3073+
3074+ return 0;
3075+}
3076+
3077+static int add_session(struct iscsi_target *target, unsigned long ptr)
3078+{
3079+ struct session_info info;
3080+ int err;
3081+
3082+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3083+ if (err)
3084+ return -EFAULT;
3085+
3086+ return session_add(target, &info);
3087+}
3088+
3089+static int del_session(struct iscsi_target *target, unsigned long ptr)
3090+{
3091+ struct session_info info;
3092+ int err;
3093+
3094+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3095+ if (err)
3096+ return -EFAULT;
3097+
3098+ return session_del(target, info.sid);
3099+}
3100+
3101+static int add_volume(struct iscsi_target *target, unsigned long ptr)
3102+{
3103+ struct volume_info info;
3104+ int err;
3105+
3106+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3107+ if (err)
3108+ return -EFAULT;
3109+
3110+ return volume_add(target, &info);
3111+}
3112+
3113+static int del_volume(struct iscsi_target *target, unsigned long ptr)
3114+{
3115+ struct volume_info info;
3116+ int err;
3117+
3118+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3119+ if (err)
3120+ return -EFAULT;
3121+
3122+ return iscsi_volume_del(target, &info);
3123+}
3124+
3125+static int iscsi_param_config(struct iscsi_target *target, unsigned long ptr, int set)
3126+{
3127+ struct iscsi_param_info info;
3128+ int err;
3129+
3130+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3131+ if (err)
3132+ return -EFAULT;
3133+
3134+ err = iscsi_param_set(target, &info, set);
3135+ if (err < 0 || set)
3136+ return err;
3137+
3138+ err = copy_to_user((void *) ptr, &info, sizeof(info));
3139+ if (err)
3140+ return -EFAULT;
3141+
3142+ return 0;
3143+}
3144+
3145+static int add_target(unsigned long ptr)
3146+{
3147+ struct target_info info;
3148+ int err;
3149+
3150+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
3151+ if (err)
3152+ return -EFAULT;
3153+
3154+ err = target_add(&info);
3155+ if (err < 0)
3156+ return err;
3157+
3158+ err = copy_to_user((void *) ptr, &info, sizeof(info));
3159+ if (err)
3160+ return -EFAULT;
3161+
3162+ return 0;
3163+}
3164+
3165+static long ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3166+{
3167+ struct iscsi_target *target = NULL;
3168+ long err;
3169+ u32 id;
3170+
3171+ err = down_interruptible(&ioctl_sem);
3172+ if (err < 0)
3173+ return err;
3174+
3175+ if (cmd == GET_MODULE_INFO) {
3176+ err = get_module_info(arg);
3177+ goto done;
3178+ }
3179+
3180+ if (cmd == ADD_TARGET) {
3181+ err = add_target(arg);
3182+ goto done;
3183+ }
3184+
3185+ err = get_user(id, (u32 *) arg);
3186+ if (err < 0)
3187+ goto done;
3188+
3189+ /* locking handled in target_del */
3190+ if (cmd == DEL_TARGET) {
3191+ err = target_del(id);
3192+ goto done;
3193+ }
3194+
3195+ target = target_lookup_by_id(id);
3196+ if (!target) {
3197+ err = -ENOENT;
3198+ goto done;
3199+ }
3200+
3201+ err = target_lock(target, 1);
3202+ if (err < 0)
3203+ goto done;
3204+
3205+ switch (cmd) {
3206+ case ADD_VOLUME:
3207+ err = add_volume(target, arg);
3208+ break;
3209+
3210+ case DEL_VOLUME:
3211+ err = del_volume(target, arg);
3212+ break;
3213+
3214+ case ADD_SESSION:
3215+ err = add_session(target, arg);
3216+ break;
3217+
3218+ case DEL_SESSION:
3219+ err = del_session(target, arg);
3220+ break;
3221+
3222+ case GET_SESSION_INFO:
3223+ err = get_session_info(target, arg);
3224+ break;
3225+
3226+ case ISCSI_PARAM_SET:
3227+ err = iscsi_param_config(target, arg, 1);
3228+ break;
3229+
3230+ case ISCSI_PARAM_GET:
3231+ err = iscsi_param_config(target, arg, 0);
3232+ break;
3233+
3234+ case ADD_CONN:
3235+ err = add_conn(target, arg);
3236+ break;
3237+
3238+ case DEL_CONN:
3239+ err = del_conn(target, arg);
3240+ break;
3241+
3242+ case GET_CONN_INFO:
3243+ err = get_conn_info(target, arg);
3244+ break;
3245+ default:
3246+ eprintk("invalid ioctl cmd %x\n", cmd);
3247+ err = -EINVAL;
3248+ }
3249+
3250+ target_unlock(target);
3251+done:
3252+ up(&ioctl_sem);
3253+
3254+ return err;
3255+}
3256+
3257+static int release(struct inode *i __attribute__((unused)),
3258+ struct file *f __attribute__((unused)))
3259+{
3260+ down(&ioctl_sem);
3261+ target_del_all();
3262+ up(&ioctl_sem);
3263+
3264+ return 0;
3265+}
3266+
3267+struct file_operations ctr_fops = {
3268+ .owner = THIS_MODULE,
3269+ .unlocked_ioctl = ioctl,
3270+ .compat_ioctl = ioctl,
3271+ .release = release
3272+};
3273
3274=== added file '.pc/debian-changes-1.4.20.2-5/kernel/conn.c'
3275--- .pc/debian-changes-1.4.20.2-5/kernel/conn.c 1970-01-01 00:00:00 +0000
3276+++ .pc/debian-changes-1.4.20.2-5/kernel/conn.c 2011-06-29 14:00:59 +0000
3277@@ -0,0 +1,262 @@
3278+/*
3279+ * Copyright (C) 2002-2003 Ardis Technolgies <roman@ardistech.com>
3280+ *
3281+ * Released under the terms of the GNU GPL v2.0.
3282+ */
3283+
3284+#include <linux/file.h>
3285+#include <linux/ip.h>
3286+#include <net/tcp.h>
3287+#include <scsi/scsi.h>
3288+
3289+#include "iscsi.h"
3290+#include "iscsi_dbg.h"
3291+#include "digest.h"
3292+
3293+static void print_conn_state(char *p, size_t size, unsigned long state)
3294+{
3295+ if (test_bit(CONN_ACTIVE, &state))
3296+ snprintf(p, size, "%s", "active");
3297+ else if (test_bit(CONN_CLOSING, &state))
3298+ snprintf(p, size, "%s", "closing");
3299+ else
3300+ snprintf(p, size, "%s", "unknown");
3301+}
3302+
3303+static void print_digest_state(char *p, size_t size, unsigned long flags)
3304+{
3305+ if (DIGEST_NONE & flags)
3306+ snprintf(p, size, "%s", "none");
3307+ else if (DIGEST_CRC32C & flags)
3308+ snprintf(p, size, "%s", "crc32c");
3309+ else
3310+ snprintf(p, size, "%s", "unknown");
3311+}
3312+
3313+void conn_info_show(struct seq_file *seq, struct iscsi_session *session)
3314+{
3315+ struct iscsi_conn *conn;
3316+ struct sock *sk;
3317+ char buf[64];
3318+
3319+ list_for_each_entry(conn, &session->conn_list, list) {
3320+ sk = conn->sock->sk;
3321+ switch (sk->sk_family) {
3322+ case AF_INET:
3323+ snprintf(buf, sizeof(buf),
3324+ "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->inet_daddr));
3325+ break;
3326+ case AF_INET6:
3327+ snprintf(buf, sizeof(buf), "[%pI6]",
3328+ &inet6_sk(sk)->daddr);
3329+ break;
3330+ default:
3331+ break;
3332+ }
3333+ seq_printf(seq, "\t\tcid:%u ip:%s ", conn->cid, buf);
3334+ print_conn_state(buf, sizeof(buf), conn->state);
3335+ seq_printf(seq, "state:%s ", buf);
3336+ print_digest_state(buf, sizeof(buf), conn->hdigest_type);
3337+ seq_printf(seq, "hd:%s ", buf);
3338+ print_digest_state(buf, sizeof(buf), conn->ddigest_type);
3339+ seq_printf(seq, "dd:%s\n", buf);
3340+ }
3341+}
3342+
3343+struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid)
3344+{
3345+ struct iscsi_conn *conn;
3346+
3347+ list_for_each_entry(conn, &session->conn_list, list) {
3348+ if (conn->cid == cid)
3349+ return conn;
3350+ }
3351+ return NULL;
3352+}
3353+
3354+static void iet_state_change(struct sock *sk)
3355+{
3356+ struct iscsi_conn *conn = sk->sk_user_data;
3357+ struct iscsi_target *target = conn->session->target;
3358+
3359+ if (sk->sk_state != TCP_ESTABLISHED)
3360+ conn_close(conn);
3361+ else
3362+ nthread_wakeup(target);
3363+
3364+ target->nthread_info.old_state_change(sk);
3365+}
3366+
3367+static void iet_data_ready(struct sock *sk, int len)
3368+{
3369+ struct iscsi_conn *conn = sk->sk_user_data;
3370+ struct iscsi_target *target = conn->session->target;
3371+
3372+ nthread_wakeup(target);
3373+ target->nthread_info.old_data_ready(sk, len);
3374+}
3375+
3376+/*
3377+ * @locking: grabs the target's nthread_lock to protect it from races with
3378+ * set_conn_wspace_wait()
3379+ */
3380+static void iet_write_space(struct sock *sk)
3381+{
3382+ struct iscsi_conn *conn = sk->sk_user_data;
3383+ struct network_thread_info *info = &conn->session->target->nthread_info;
3384+
3385+ spin_lock_bh(&info->nthread_lock);
3386+
3387+ if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) &&
3388+ test_bit(CONN_WSPACE_WAIT, &conn->state)) {
3389+ clear_bit(CONN_WSPACE_WAIT, &conn->state);
3390+ __nthread_wakeup(info);
3391+ }
3392+
3393+ spin_unlock_bh(&info->nthread_lock);
3394+
3395+ info->old_write_space(sk);
3396+}
3397+
3398+static void iet_socket_bind(struct iscsi_conn *conn)
3399+{
3400+ int opt = 1;
3401+ mm_segment_t oldfs;
3402+ struct iscsi_session *session = conn->session;
3403+ struct iscsi_target *target = session->target;
3404+
3405+ dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid);
3406+
3407+ conn->sock = SOCKET_I(conn->file->f_dentry->d_inode);
3408+ conn->sock->sk->sk_user_data = conn;
3409+
3410+ write_lock_bh(&conn->sock->sk->sk_callback_lock);
3411+ target->nthread_info.old_state_change = conn->sock->sk->sk_state_change;
3412+ conn->sock->sk->sk_state_change = iet_state_change;
3413+
3414+ target->nthread_info.old_data_ready = conn->sock->sk->sk_data_ready;
3415+ conn->sock->sk->sk_data_ready = iet_data_ready;
3416+
3417+ target->nthread_info.old_write_space = conn->sock->sk->sk_write_space;
3418+ conn->sock->sk->sk_write_space = iet_write_space;
3419+ write_unlock_bh(&conn->sock->sk->sk_callback_lock);
3420+
3421+ oldfs = get_fs();
3422+ set_fs(get_ds());
3423+ conn->sock->ops->setsockopt(conn->sock, SOL_TCP, TCP_NODELAY, (void *)&opt, sizeof(opt));
3424+ set_fs(oldfs);
3425+}
3426+
3427+int conn_free(struct iscsi_conn *conn)
3428+{
3429+ dprintk(D_GENERIC, "%p %#Lx %u\n", conn->session,
3430+ (unsigned long long) conn->session->sid, conn->cid);
3431+
3432+ assert(atomic_read(&conn->nr_cmnds) == 0);
3433+ assert(list_empty(&conn->pdu_list));
3434+ assert(list_empty(&conn->write_list));
3435+
3436+ list_del(&conn->list);
3437+ list_del(&conn->poll_list);
3438+
3439+ del_timer_sync(&conn->nop_timer);
3440+ digest_cleanup(conn);
3441+ kfree(conn);
3442+
3443+ return 0;
3444+}
3445+
3446+static int iet_conn_alloc(struct iscsi_session *session, struct conn_info *info)
3447+{
3448+ struct iscsi_conn *conn;
3449+
3450+ dprintk(D_SETUP, "%#Lx:%u\n", (unsigned long long) session->sid, info->cid);
3451+
3452+ conn = kzalloc(sizeof(*conn), GFP_KERNEL);
3453+ if (!conn)
3454+ return -ENOMEM;
3455+
3456+ conn->session = session;
3457+ conn->cid = info->cid;
3458+ conn->stat_sn = info->stat_sn;
3459+ conn->exp_stat_sn = info->exp_stat_sn;
3460+
3461+ conn->hdigest_type = info->header_digest;
3462+ conn->ddigest_type = info->data_digest;
3463+ if (digest_init(conn) < 0) {
3464+ kfree(conn);
3465+ return -ENOMEM;
3466+ }
3467+
3468+ spin_lock_init(&conn->list_lock);
3469+ atomic_set(&conn->nr_cmnds, 0);
3470+ atomic_set(&conn->nr_busy_cmnds, 0);
3471+ INIT_LIST_HEAD(&conn->pdu_list);
3472+ INIT_LIST_HEAD(&conn->write_list);
3473+ INIT_LIST_HEAD(&conn->poll_list);
3474+ init_timer(&conn->nop_timer);
3475+
3476+ list_add(&conn->list, &session->conn_list);
3477+
3478+ set_bit(CONN_ACTIVE, &conn->state);
3479+
3480+ conn->file = fget(info->fd);
3481+ iet_socket_bind(conn);
3482+
3483+ list_add(&conn->poll_list, &session->target->nthread_info.active_conns);
3484+
3485+ nthread_wakeup(conn->session->target);
3486+
3487+ return 0;
3488+}
3489+
3490+void conn_close(struct iscsi_conn *conn)
3491+{
3492+ struct iscsi_cmnd *cmnd;
3493+ struct iscsi_session *session = conn->session;
3494+
3495+ if (test_and_clear_bit(CONN_ACTIVE, &conn->state))
3496+ set_bit(CONN_CLOSING, &conn->state);
3497+
3498+ spin_lock(&conn->list_lock);
3499+ list_for_each_entry(cmnd, &conn->pdu_list, conn_list) {
3500+ set_cmnd_tmfabort(cmnd);
3501+ if (cmnd->lun) {
3502+ ua_establish_for_session(session, cmnd->lun->lun, 0x47, 0x7f);
3503+ iscsi_cmnd_set_sense(cmnd, UNIT_ATTENTION, 0x6e, 0x0);
3504+ }
3505+ }
3506+ spin_unlock(&conn->list_lock);
3507+
3508+ nthread_wakeup(conn->session->target);
3509+}
3510+
3511+int conn_add(struct iscsi_session *session, struct conn_info *info)
3512+{
3513+ struct iscsi_conn *conn;
3514+ int err;
3515+
3516+ conn = conn_lookup(session, info->cid);
3517+ if (conn)
3518+ conn_close(conn);
3519+
3520+ err = iet_conn_alloc(session, info);
3521+ if (!err && conn)
3522+ err = -EEXIST;
3523+
3524+ return err;
3525+}
3526+
3527+int conn_del(struct iscsi_session *session, struct conn_info *info)
3528+{
3529+ struct iscsi_conn *conn;
3530+ int err = -EEXIST;
3531+
3532+ conn = conn_lookup(session, info->cid);
3533+ if (!conn)
3534+ return err;
3535+
3536+ conn_close(conn);
3537+
3538+ return 0;
3539+}
3540
3541=== added file '.pc/debian-changes-1.4.20.2-5/kernel/iotype.c'
3542--- .pc/debian-changes-1.4.20.2-5/kernel/iotype.c 1970-01-01 00:00:00 +0000
3543+++ .pc/debian-changes-1.4.20.2-5/kernel/iotype.c 2011-06-29 14:00:59 +0000
3544@@ -0,0 +1,110 @@
3545+/*
3546+ * Manager for various I/O types.
3547+ * (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
3548+ * This code is licenced under the GPL.
3549+ */
3550+
3551+#include "iscsi.h"
3552+#include "iotype.h"
3553+#include "iscsi_dbg.h"
3554+
3555+static LIST_HEAD(iotypes);
3556+static rwlock_t iotypes_lock = RW_LOCK_UNLOCKED;
3557+
3558+static struct iotype *find_iotype(const char *name)
3559+{
3560+ struct iotype *iot = NULL;
3561+
3562+ list_for_each_entry(iot, &iotypes, iot_list) {
3563+ if (strcmp(iot->name, name) == 0)
3564+ return iot;
3565+ }
3566+ return NULL;
3567+}
3568+
3569+struct iotype *get_iotype(const char *name)
3570+{
3571+ struct iotype *iot;
3572+
3573+ read_lock(&iotypes_lock);
3574+ iot = find_iotype(name);
3575+ read_unlock(&iotypes_lock);
3576+
3577+ return iot;
3578+}
3579+
3580+void put_iotype(struct iotype *iot)
3581+{
3582+ if (!iot)
3583+ return;
3584+ return;
3585+}
3586+
3587+static int register_iotype(struct iotype *iot)
3588+{
3589+ int err = 0;
3590+ struct iotype *p;
3591+
3592+ write_lock(&iotypes_lock);
3593+
3594+ p = find_iotype(iot->name);
3595+ if (p)
3596+ err = -EBUSY;
3597+ else
3598+ list_add_tail(&iot->iot_list, &iotypes);
3599+
3600+ write_unlock(&iotypes_lock);
3601+
3602+ return err;
3603+}
3604+
3605+static int unregister_iotype(struct iotype *iot)
3606+{
3607+ int err = 0;
3608+ struct iotype *p;
3609+
3610+ write_lock(&iotypes_lock);
3611+
3612+ p = find_iotype(iot->name);
3613+ if (p && p == iot)
3614+ list_del_init(&iot->iot_list);
3615+ else
3616+ err = -EINVAL;
3617+
3618+ write_unlock(&iotypes_lock);
3619+
3620+
3621+ return err;
3622+}
3623+
3624+struct iotype *iotype_array[] = {
3625+ &fileio,
3626+ &blockio,
3627+ &nullio,
3628+};
3629+
3630+int iotype_init(void)
3631+{
3632+ int i, err;
3633+
3634+ for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
3635+ if (!(err = register_iotype(iotype_array[i])))
3636+ iprintk("Registered io type %s\n",
3637+ iotype_array[i]->name);
3638+ else {
3639+ eprintk("Failed to register io type %s\n",
3640+ iotype_array[i]->name);
3641+ break;
3642+ }
3643+ }
3644+
3645+ return err;
3646+}
3647+
3648+void iotype_exit(void)
3649+{
3650+ int i;
3651+
3652+ for (i = 0; i < ARRAY_SIZE(iotype_array); i++)
3653+ unregister_iotype(iotype_array[i]);
3654+}
3655
3656=== added file '.pc/debian-changes-1.4.20.2-5/kernel/iscsi.c'
3657--- .pc/debian-changes-1.4.20.2-5/kernel/iscsi.c 1970-01-01 00:00:00 +0000
3658+++ .pc/debian-changes-1.4.20.2-5/kernel/iscsi.c 2011-06-29 14:00:59 +0000
3659@@ -0,0 +1,1967 @@
3660+/*
3661+ * Copyright (C) 2002-2003 Ardis Technolgies <roman@ardistech.com>
3662+ * Copyright (C) 2008 Arne Redlich <agr@powerkom-dd.de>
3663+ *
3664+ * Released under the terms of the GNU GPL v2.0.
3665+ */
3666+
3667+#include <linux/module.h>
3668+#include <linux/hash.h>
3669+#include <net/tcp.h>
3670+#include <scsi/scsi.h>
3671+
3672+#include "iscsi.h"
3673+#include "iscsi_dbg.h"
3674+#include "iotype.h"
3675+
3676+unsigned long debug_enable_flags;
3677+unsigned long worker_thread_pool_size;
3678+
3679+static struct kmem_cache *iscsi_cmnd_cache;
3680+static u8 dummy_data[PAGE_SIZE];
3681+
3682+static int ctr_major;
3683+static char ctr_name[] = "ietctl";
3684+extern struct file_operations ctr_fops;
3685+
3686+static u32 cmnd_write_size(struct iscsi_cmnd *cmnd)
3687+{
3688+ struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
3689+
3690+ if (hdr->flags & ISCSI_CMD_WRITE)
3691+ return be32_to_cpu(hdr->data_length);
3692+ return 0;
3693+}
3694+
3695+static u32 cmnd_read_size(struct iscsi_cmnd *cmnd)
3696+{
3697+ struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
3698+
3699+ if (hdr->flags & ISCSI_CMD_READ) {
3700+ struct iscsi_rlength_ahdr *ahdr =
3701+ (struct iscsi_rlength_ahdr *)cmnd->pdu.ahs;
3702+
3703+ if (!(hdr->flags & ISCSI_CMD_WRITE))
3704+ return be32_to_cpu(hdr->data_length);
3705+ if (ahdr && ahdr->ahstype == ISCSI_AHSTYPE_RLENGTH)
3706+ return be32_to_cpu(ahdr->read_length);
3707+ }
3708+ return 0;
3709+}
3710+
3711+static void iscsi_device_queue_cmnd(struct iscsi_cmnd *cmnd)
3712+{
3713+ set_cmnd_waitio(cmnd);
3714+ wthread_queue(cmnd);
3715+}
3716+
3717+static void iscsi_scsi_queuecmnd(struct iscsi_cmnd *cmnd)
3718+{
3719+ struct iscsi_queue *queue = &cmnd->lun->queue;
3720+
3721+ dprintk(D_GENERIC, "%p\n", cmnd);
3722+
3723+ if ((cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) != ISCSI_CMD_UNTAGGED &&
3724+ (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) != ISCSI_CMD_SIMPLE) {
3725+ cmnd->pdu.bhs.flags &= ~ISCSI_CMD_ATTR_MASK;
3726+ cmnd->pdu.bhs.flags |= ISCSI_CMD_UNTAGGED;
3727+ }
3728+
3729+ spin_lock(&queue->queue_lock);
3730+
3731+ set_cmnd_queued(cmnd);
3732+
3733+ switch (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) {
3734+ case ISCSI_CMD_UNTAGGED:
3735+ case ISCSI_CMD_SIMPLE:
3736+ if (!list_empty(&queue->wait_list) || queue->ordered_cmnd)
3737+ goto pending;
3738+ queue->active_cnt++;
3739+ break;
3740+
3741+ default:
3742+ BUG();
3743+ }
3744+ spin_unlock(&queue->queue_lock);
3745+
3746+ iscsi_device_queue_cmnd(cmnd);
3747+ return;
3748+ pending:
3749+ assert(list_empty(&cmnd->list));
3750+
3751+ list_add_tail(&cmnd->list, &queue->wait_list);
3752+ spin_unlock(&queue->queue_lock);
3753+ return;
3754+}
3755+
3756+static void iscsi_scsi_dequeuecmnd(struct iscsi_cmnd *cmnd)
3757+{
3758+ struct iscsi_queue *queue;
3759+
3760+ if (!cmnd->lun)
3761+ return;
3762+ queue = &cmnd->lun->queue;
3763+ spin_lock(&queue->queue_lock);
3764+ switch (cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK) {
3765+ case ISCSI_CMD_UNTAGGED:
3766+ case ISCSI_CMD_SIMPLE:
3767+ --queue->active_cnt;
3768+ break;
3769+ case ISCSI_CMD_ORDERED:
3770+ case ISCSI_CMD_HEAD_OF_QUEUE:
3771+ case ISCSI_CMD_ACA:
3772+ BUG();
3773+ default:
3774+ /* Should the iscsi_scsi_queuecmnd func reject this ? */
3775+ break;
3776+ }
3777+
3778+ while (!list_empty(&queue->wait_list)) {
3779+ cmnd = list_entry(queue->wait_list.next, struct iscsi_cmnd, list);
3780+ switch ((cmnd->pdu.bhs.flags & ISCSI_CMD_ATTR_MASK)) {
3781+ case ISCSI_CMD_UNTAGGED:
3782+ case ISCSI_CMD_SIMPLE:
3783+ list_del_init(&cmnd->list);
3784+ queue->active_cnt++;
3785+ iscsi_device_queue_cmnd(cmnd);
3786+ break;
3787+ case ISCSI_CMD_ORDERED:
3788+ case ISCSI_CMD_HEAD_OF_QUEUE:
3789+ case ISCSI_CMD_ACA:
3790+ BUG();
3791+ }
3792+ }
3793+
3794+ spin_unlock(&queue->queue_lock);
3795+
3796+ return;
3797+}
3798+
3799+/**
3800+ * create a new command.
3801+ *
3802+ * iscsi_cmnd_create -
3803+ * @conn: ptr to connection (for i/o)
3804+ *
3805+ * @return ptr to command or NULL
3806+ */
3807+
3808+struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn, int req)
3809+{
3810+ struct iscsi_cmnd *cmnd;
3811+
3812+ /* TODO: async interface is necessary ? */
3813+ cmnd = kmem_cache_alloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
3814+
3815+ memset(cmnd, 0, sizeof(*cmnd));
3816+ INIT_LIST_HEAD(&cmnd->list);
3817+ INIT_LIST_HEAD(&cmnd->pdu_list);
3818+ INIT_LIST_HEAD(&cmnd->conn_list);
3819+ INIT_LIST_HEAD(&cmnd->hash_list);
3820+ cmnd->conn = conn;
3821+ spin_lock(&conn->list_lock);
3822+ atomic_inc(&conn->nr_cmnds);
3823+ if (req)
3824+ list_add_tail(&cmnd->conn_list, &conn->pdu_list);
3825+ spin_unlock(&conn->list_lock);
3826+ cmnd->tio = NULL;
3827+
3828+ dprintk(D_GENERIC, "%p:%p\n", conn, cmnd);
3829+
3830+ return cmnd;
3831+}
3832+
3833+/**
3834+ * create a new command used as response.
3835+ *
3836+ * iscsi_cmnd_create_rsp_cmnd -
3837+ * @cmnd: ptr to request command
3838+ *
3839+ * @return ptr to response command or NULL
3840+ */
3841+
3842+static struct iscsi_cmnd *iscsi_cmnd_create_rsp_cmnd(struct iscsi_cmnd *cmnd, int final)
3843+{
3844+ struct iscsi_cmnd *rsp = cmnd_alloc(cmnd->conn, 0);
3845+
3846+ if (final)
3847+ set_cmnd_final(rsp);
3848+ list_add_tail(&rsp->pdu_list, &cmnd->pdu_list);
3849+ rsp->req = cmnd;
3850+ return rsp;
3851+}
3852+
3853+static struct iscsi_cmnd *get_rsp_cmnd(struct iscsi_cmnd *req)
3854+{
3855+ return list_entry(req->pdu_list.prev, struct iscsi_cmnd, pdu_list);
3856+}
3857+
3858+static void iscsi_cmnds_init_write(struct list_head *send)
3859+{
3860+ struct iscsi_cmnd *cmnd = list_entry(send->next, struct iscsi_cmnd, list);
3861+ struct iscsi_conn *conn = cmnd->conn;
3862+ struct list_head *pos, *next;
3863+
3864+ spin_lock(&conn->list_lock);
3865+
3866+ list_for_each_safe(pos, next, send) {
3867+ cmnd = list_entry(pos, struct iscsi_cmnd, list);
3868+
3869+ dprintk(D_GENERIC, "%p:%x\n", cmnd, cmnd_opcode(cmnd));
3870+
3871+ list_del_init(&cmnd->list);
3872+ assert(conn == cmnd->conn);
3873+ list_add_tail(&cmnd->list, &conn->write_list);
3874+ }
3875+
3876+ spin_unlock(&conn->list_lock);
3877+
3878+ nthread_wakeup(conn->session->target);
3879+}
3880+
3881+static void iscsi_cmnd_init_write(struct iscsi_cmnd *cmnd)
3882+{
3883+ LIST_HEAD(head);
3884+
3885+ if (!list_empty(&cmnd->list)) {
3886+ eprintk("%x %x %x %x %lx %u %u %u %u %u %u %u %d %d\n",
3887+ cmnd_itt(cmnd), cmnd_ttt(cmnd), cmnd_opcode(cmnd),
3888+ cmnd_scsicode(cmnd), cmnd->flags, cmnd->r2t_sn,
3889+ cmnd->r2t_length, cmnd->is_unsolicited_data,
3890+ cmnd->target_task_tag, cmnd->outstanding_r2t,
3891+ cmnd->hdigest, cmnd->ddigest,
3892+ list_empty(&cmnd->pdu_list), list_empty(&cmnd->hash_list));
3893+
3894+ assert(list_empty(&cmnd->list));
3895+ }
3896+ list_add(&cmnd->list, &head);
3897+ iscsi_cmnds_init_write(&head);
3898+}
3899+
3900+static void do_send_data_rsp(struct iscsi_cmnd *cmnd)
3901+{
3902+ struct iscsi_conn *conn = cmnd->conn;
3903+ struct iscsi_cmnd *data_cmnd;
3904+ struct tio *tio = cmnd->tio;
3905+ struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd);
3906+ struct iscsi_data_in_hdr *rsp;
3907+ u32 pdusize, expsize, scsisize, size, offset, sn;
3908+ LIST_HEAD(send);
3909+
3910+ dprintk(D_GENERIC, "%p\n", cmnd);
3911+ pdusize = conn->session->param.max_xmit_data_length;
3912+ expsize = cmnd_read_size(cmnd);
3913+ size = min(expsize, tio->size);
3914+ offset = 0;
3915+ sn = 0;
3916+
3917+ while (1) {
3918+ data_cmnd = iscsi_cmnd_create_rsp_cmnd(cmnd, size <= pdusize);
3919+ tio_get(tio);
3920+ data_cmnd->tio = tio;
3921+ rsp = (struct iscsi_data_in_hdr *)&data_cmnd->pdu.bhs;
3922+
3923+ rsp->opcode = ISCSI_OP_SCSI_DATA_IN;
3924+ rsp->itt = req->itt;
3925+ rsp->ttt = cpu_to_be32(ISCSI_RESERVED_TAG);
3926+ rsp->buffer_offset = offset;
3927+ rsp->data_sn = cpu_to_be32(sn);
3928+
3929+ if (size <= pdusize) {
3930+ data_cmnd->pdu.datasize = size;
3931+ rsp->flags = ISCSI_FLG_FINAL | ISCSI_FLG_STATUS;
3932+
3933+ scsisize = tio->size;
3934+ if (scsisize < expsize) {
3935+ rsp->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
3936+ size = expsize - scsisize;
3937+ } else if (scsisize > expsize) {
3938+ rsp->flags |= ISCSI_FLG_RESIDUAL_OVERFLOW;
3939+ size = scsisize - expsize;
3940+ } else
3941+ size = 0;
3942+ rsp->residual_count = cpu_to_be32(size);
3943+ list_add_tail(&data_cmnd->list, &send);
3944+
3945+ break;
3946+ }
3947+
3948+ data_cmnd->pdu.datasize = pdusize;
3949+
3950+ size -= pdusize;
3951+ offset += pdusize;
3952+ sn++;
3953+
3954+ list_add_tail(&data_cmnd->list, &send);
3955+ }
3956+
3957+ iscsi_cmnds_init_write(&send);
3958+}
3959+
3960+static struct iscsi_cmnd *create_scsi_rsp(struct iscsi_cmnd *req)
3961+{
3962+ struct iscsi_cmnd *rsp;
3963+ struct iscsi_scsi_cmd_hdr *req_hdr = cmnd_hdr(req);
3964+ struct iscsi_scsi_rsp_hdr *rsp_hdr;
3965+ struct iscsi_sense_data *sense;
3966+
3967+ rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
3968+
3969+ rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs;
3970+ rsp_hdr->opcode = ISCSI_OP_SCSI_RSP;
3971+ rsp_hdr->flags = ISCSI_FLG_FINAL;
3972+ rsp_hdr->response = ISCSI_RESPONSE_COMMAND_COMPLETED;
3973+ rsp_hdr->cmd_status = req->status;
3974+ rsp_hdr->itt = req_hdr->itt;
3975+
3976+ if (req->status == SAM_STAT_CHECK_CONDITION) {
3977+ assert(!rsp->tio);
3978+ rsp->tio = tio_alloc(1);
3979+ sense = (struct iscsi_sense_data *)
3980+ page_address(rsp->tio->pvec[0]);
3981+
3982+ assert(sense);
3983+ clear_page(sense);
3984+ sense->length = cpu_to_be16(IET_SENSE_BUF_SIZE);
3985+
3986+ memcpy(sense->data, req->sense_buf, IET_SENSE_BUF_SIZE);
3987+ rsp->pdu.datasize = sizeof(struct iscsi_sense_data) +
3988+ IET_SENSE_BUF_SIZE;
3989+
3990+ rsp->tio->size = (rsp->pdu.datasize + 3) & -4;
3991+ rsp->tio->offset = 0;
3992+ }
3993+
3994+ return rsp;
3995+}
3996+
3997+void iscsi_cmnd_set_sense(struct iscsi_cmnd *cmnd, u8 sense_key, u8 asc,
3998+ u8 ascq)
3999+{
4000+ cmnd->status = SAM_STAT_CHECK_CONDITION;
4001+
4002+ cmnd->sense_buf[0] = 0xf0;
4003+ cmnd->sense_buf[2] = sense_key;
4004+ cmnd->sense_buf[7] = 6; // Additional sense length
4005+ cmnd->sense_buf[12] = asc;
4006+ cmnd->sense_buf[13] = ascq;
4007+
4008+ /* Call to ACA/UAI handler */
4009+}
4010+
4011+static struct iscsi_cmnd *create_sense_rsp(struct iscsi_cmnd *req,
4012+ u8 sense_key, u8 asc, u8 ascq)
4013+{
4014+ iscsi_cmnd_set_sense(req, sense_key, asc, ascq);
4015+ return create_scsi_rsp(req);
4016+}
4017+
4018+void send_scsi_rsp(struct iscsi_cmnd *req, void (*func)(struct iscsi_cmnd *))
4019+{
4020+ struct iscsi_cmnd *rsp;
4021+ struct iscsi_scsi_rsp_hdr *rsp_hdr;
4022+ u32 size;
4023+
4024+ func(req);
4025+ rsp = create_scsi_rsp(req);
4026+
4027+ switch (req->status) {
4028+ case SAM_STAT_GOOD:
4029+ case SAM_STAT_RESERVATION_CONFLICT:
4030+ rsp_hdr = (struct iscsi_scsi_rsp_hdr *) &rsp->pdu.bhs;
4031+ if ((size = cmnd_read_size(req)) != 0) {
4032+ rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
4033+ rsp_hdr->residual_count = cpu_to_be32(size);
4034+ }
4035+ break;
4036+ default:
4037+ break;
4038+ }
4039+
4040+ iscsi_cmnd_init_write(rsp);
4041+}
4042+
4043+void send_data_rsp(struct iscsi_cmnd *req, void (*func)(struct iscsi_cmnd *))
4044+{
4045+ struct iscsi_cmnd *rsp;
4046+
4047+ func(req);
4048+
4049+ if (req->status == SAM_STAT_GOOD)
4050+ do_send_data_rsp(req);
4051+ else {
4052+ rsp = create_scsi_rsp(req);
4053+ iscsi_cmnd_init_write(rsp);
4054+ }
4055+}
4056+
4057+/**
4058+ * Free a command.
4059+ * Also frees the additional header.
4060+ *
4061+ * iscsi_cmnd_remove -
4062+ * @cmnd: ptr to command
4063+ */
4064+
4065+static void iscsi_cmnd_remove(struct iscsi_cmnd *cmnd)
4066+{
4067+ struct iscsi_conn *conn;
4068+
4069+ if (!cmnd)
4070+ return;
4071+
4072+ if (cmnd_timer_active(cmnd)) {
4073+ clear_cmnd_timer_active(cmnd);
4074+ del_timer_sync(&cmnd->timer);
4075+ }
4076+
4077+ dprintk(D_GENERIC, "%p\n", cmnd);
4078+ conn = cmnd->conn;
4079+ kfree(cmnd->pdu.ahs);
4080+
4081+ if (!list_empty(&cmnd->list)) {
4082+ struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd);
4083+
4084+ eprintk("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x %lx\n",
4085+ cmnd, req->opcode, req->scb[0], req->flags, req->itt,
4086+ be32_to_cpu(req->data_length),
4087+ req->cmd_sn, be32_to_cpu(cmnd->pdu.datasize),
4088+ conn->state);
4089+
4090+ if (cmnd->req) {
4091+ struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd->req);
4092+ eprintk("%p %x %u\n", req, req->opcode, req->scb[0]);
4093+ }
4094+ dump_stack();
4095+ BUG();
4096+ }
4097+ list_del(&cmnd->list);
4098+ spin_lock(&conn->list_lock);
4099+ atomic_dec(&conn->nr_cmnds);
4100+ list_del(&cmnd->conn_list);
4101+ spin_unlock(&conn->list_lock);
4102+
4103+ if (cmnd->tio)
4104+ tio_put(cmnd->tio);
4105+
4106+ kmem_cache_free(iscsi_cmnd_cache, cmnd);
4107+}
4108+
4109+static void cmnd_skip_pdu(struct iscsi_cmnd *cmnd)
4110+{
4111+ struct iscsi_conn *conn = cmnd->conn;
4112+ struct tio *tio = cmnd->tio;
4113+ char *addr;
4114+ u32 size;
4115+ int i;
4116+
4117+ eprintk("%x %x %x %u\n", cmnd_itt(cmnd), cmnd_opcode(cmnd),
4118+ cmnd_hdr(cmnd)->scb[0], cmnd->pdu.datasize);
4119+
4120+ if (!(size = cmnd->pdu.datasize))
4121+ return;
4122+
4123+ if (tio)
4124+ assert(tio->pg_cnt > 0);
4125+ else
4126+ tio = cmnd->tio = tio_alloc(1);
4127+
4128+ addr = page_address(tio->pvec[0]);
4129+ assert(addr);
4130+ size = (size + 3) & -4;
4131+ conn->read_size = size;
4132+ for (i = 0; size > PAGE_CACHE_SIZE; i++, size -= PAGE_CACHE_SIZE) {
4133+ assert(i < ISCSI_CONN_IOV_MAX);
4134+ conn->read_iov[i].iov_base = addr;
4135+ conn->read_iov[i].iov_len = PAGE_CACHE_SIZE;
4136+ }
4137+ conn->read_iov[i].iov_base = addr;
4138+ conn->read_iov[i].iov_len = size;
4139+ conn->read_msg.msg_iov = conn->read_iov;
4140+ conn->read_msg.msg_iovlen = ++i;
4141+}
4142+
4143+static void iscsi_cmnd_reject(struct iscsi_cmnd *req, int reason)
4144+{
4145+ struct iscsi_cmnd *rsp;
4146+ struct iscsi_reject_hdr *rsp_hdr;
4147+ struct tio *tio;
4148+ char *addr;
4149+
4150+ rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
4151+ rsp_hdr = (struct iscsi_reject_hdr *)&rsp->pdu.bhs;
4152+
4153+ rsp_hdr->opcode = ISCSI_OP_REJECT;
4154+ rsp_hdr->ffffffff = ISCSI_RESERVED_TAG;
4155+ rsp_hdr->reason = reason;
4156+
4157+ rsp->tio = tio = tio_alloc(1);
4158+ addr = page_address(tio->pvec[0]);
4159+ clear_page(addr);
4160+ memcpy(addr, &req->pdu.bhs, sizeof(struct iscsi_hdr));
4161+ tio->size = rsp->pdu.datasize = sizeof(struct iscsi_hdr);
4162+ cmnd_skip_pdu(req);
4163+
4164+ req->pdu.bhs.opcode = ISCSI_OP_PDU_REJECT;
4165+}
4166+
4167+static void cmnd_set_sn(struct iscsi_cmnd *cmnd, int set_stat_sn)
4168+{
4169+ struct iscsi_conn *conn = cmnd->conn;
4170+ struct iscsi_session *sess = conn->session;
4171+
4172+ if (set_stat_sn)
4173+ cmnd->pdu.bhs.sn = cpu_to_be32(conn->stat_sn++);
4174+ cmnd->pdu.bhs.exp_sn = cpu_to_be32(sess->exp_cmd_sn);
4175+ cmnd->pdu.bhs.max_sn = cpu_to_be32(sess->exp_cmd_sn + sess->max_queued_cmnds);
4176+}
4177+
4178+static void update_stat_sn(struct iscsi_cmnd *cmnd)
4179+{
4180+ struct iscsi_conn *conn = cmnd->conn;
4181+ u32 exp_stat_sn;
4182+
4183+ cmnd->pdu.bhs.exp_sn = exp_stat_sn = be32_to_cpu(cmnd->pdu.bhs.exp_sn);
4184+ dprintk(D_GENERIC, "%x,%x\n", cmnd_opcode(cmnd), exp_stat_sn);
4185+ if ((int)(exp_stat_sn - conn->exp_stat_sn) > 0 &&
4186+ (int)(exp_stat_sn - conn->stat_sn) <= 0) {
4187+ // free pdu resources
4188+ cmnd->conn->exp_stat_sn = exp_stat_sn;
4189+ }
4190+}
4191+
4192+static int check_cmd_sn(struct iscsi_cmnd *cmnd)
4193+{
4194+ struct iscsi_session *session = cmnd->conn->session;
4195+ u32 cmd_sn;
4196+
4197+ cmnd->pdu.bhs.sn = cmd_sn = be32_to_cpu(cmnd->pdu.bhs.sn);
4198+
4199+ dprintk(D_GENERIC, "cmd_sn(%u) exp_cmd_sn(%u) max_cmd_sn(%u)\n",
4200+ cmd_sn, session->exp_cmd_sn, session->max_cmd_sn);
4201+
4202+ if (between(cmd_sn, session->exp_cmd_sn, session->max_cmd_sn))
4203+ return 0;
4204+ else if (cmnd_immediate(cmnd))
4205+ return 0;
4206+
4207+ eprintk("sequence error: cmd_sn(%u) exp_cmd_sn(%u) max_cmd_sn(%u)\n",
4208+ cmd_sn, session->exp_cmd_sn, session->max_cmd_sn);
4209+
4210+ set_cmnd_tmfabort(cmnd);
4211+
4212+ return -ISCSI_REASON_PROTOCOL_ERROR;
4213+}
4214+
4215+static struct iscsi_cmnd *__cmnd_find_hash(struct iscsi_session *session, u32 itt, u32 ttt)
4216+{
4217+ struct list_head *head;
4218+ struct iscsi_cmnd *cmnd;
4219+
4220+ head = &session->cmnd_hash[cmnd_hashfn(itt)];
4221+
4222+ list_for_each_entry(cmnd, head, hash_list) {
4223+ if (cmnd->pdu.bhs.itt == itt) {
4224+ if ((ttt != ISCSI_RESERVED_TAG) && (ttt != cmnd->target_task_tag))
4225+ continue;
4226+ return cmnd;
4227+ }
4228+ }
4229+
4230+ return NULL;
4231+}
4232+
4233+static struct iscsi_cmnd *cmnd_find_hash(struct iscsi_session *session, u32 itt, u32 ttt)
4234+{
4235+ struct iscsi_cmnd *cmnd;
4236+
4237+ spin_lock(&session->cmnd_hash_lock);
4238+
4239+ cmnd = __cmnd_find_hash(session, itt, ttt);
4240+
4241+ spin_unlock(&session->cmnd_hash_lock);
4242+
4243+ return cmnd;
4244+}
4245+
4246+static int cmnd_insert_hash_ttt(struct iscsi_cmnd *cmnd, u32 ttt)
4247+{
4248+ struct iscsi_session *session = cmnd->conn->session;
4249+ struct iscsi_cmnd *tmp;
4250+ struct list_head *head;
4251+ int err = 0;
4252+ u32 itt = cmnd->pdu.bhs.itt;
4253+
4254+ head = &session->cmnd_hash[cmnd_hashfn(itt)];
4255+
4256+ spin_lock(&session->cmnd_hash_lock);
4257+
4258+ tmp = __cmnd_find_hash(session, itt, ttt);
4259+ if (!tmp) {
4260+ list_add_tail(&cmnd->hash_list, head);
4261+ set_cmnd_hashed(cmnd);
4262+ } else
4263+ err = -ISCSI_REASON_TASK_IN_PROGRESS;
4264+
4265+ spin_unlock(&session->cmnd_hash_lock);
4266+
4267+ return err;
4268+}
4269+
4270+static int cmnd_insert_hash(struct iscsi_cmnd *cmnd)
4271+{
4272+ int err;
4273+
4274+ dprintk(D_GENERIC, "%p:%x\n", cmnd, cmnd->pdu.bhs.itt);
4275+
4276+ if (cmnd->pdu.bhs.itt == ISCSI_RESERVED_TAG)
4277+ return -ISCSI_REASON_PROTOCOL_ERROR;
4278+
4279+ err = cmnd_insert_hash_ttt(cmnd, ISCSI_RESERVED_TAG);
4280+ if (!err) {
4281+ update_stat_sn(cmnd);
4282+ err = check_cmd_sn(cmnd);
4283+ } else if (!cmnd_immediate(cmnd))
4284+ set_cmnd_tmfabort(cmnd);
4285+
4286+ return err;
4287+}
4288+
4289+static void __cmnd_remove_hash(struct iscsi_cmnd *cmnd)
4290+{
4291+ list_del(&cmnd->hash_list);
4292+}
4293+
4294+static void cmnd_remove_hash(struct iscsi_cmnd *cmnd)
4295+{
4296+ struct iscsi_session *session = cmnd->conn->session;
4297+ struct iscsi_cmnd *tmp;
4298+
4299+ spin_lock(&session->cmnd_hash_lock);
4300+
4301+ tmp = __cmnd_find_hash(session, cmnd->pdu.bhs.itt,
4302+ cmnd->target_task_tag);
4303+ if (tmp && tmp == cmnd)
4304+ __cmnd_remove_hash(tmp);
4305+ else
4306+ eprintk("%p:%x not found\n", cmnd, cmnd_itt(cmnd));
4307+
4308+ spin_unlock(&session->cmnd_hash_lock);
4309+}
4310+
4311+static void cmnd_skip_data(struct iscsi_cmnd *req)
4312+{
4313+ struct iscsi_cmnd *rsp;
4314+ struct iscsi_scsi_rsp_hdr *rsp_hdr;
4315+ u32 size;
4316+
4317+ rsp = get_rsp_cmnd(req);
4318+ rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs;
4319+ if (cmnd_opcode(rsp) != ISCSI_OP_SCSI_RSP) {
4320+ eprintk("unexpected response command %u\n", cmnd_opcode(rsp));
4321+ return;
4322+ }
4323+
4324+ size = cmnd_write_size(req);
4325+ if (size) {
4326+ rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
4327+ rsp_hdr->residual_count = cpu_to_be32(size);
4328+ }
4329+ size = cmnd_read_size(req);
4330+ if (size) {
4331+ if (cmnd_hdr(req)->flags & ISCSI_CMD_WRITE) {
4332+ rsp_hdr->flags |= ISCSI_FLG_BIRESIDUAL_UNDERFLOW;
4333+ rsp_hdr->bi_residual_count = cpu_to_be32(size);
4334+ } else {
4335+ rsp_hdr->flags |= ISCSI_FLG_RESIDUAL_UNDERFLOW;
4336+ rsp_hdr->residual_count = cpu_to_be32(size);
4337+ }
4338+ }
4339+ req->pdu.bhs.opcode =
4340+ (req->pdu.bhs.opcode & ~ISCSI_OPCODE_MASK) | ISCSI_OP_SCSI_REJECT;
4341+
4342+ cmnd_skip_pdu(req);
4343+}
4344+
4345+static int cmnd_recv_pdu(struct iscsi_conn *conn, struct tio *tio, u32 offset, u32 size)
4346+{
4347+ int idx, i;
4348+ char *addr;
4349+
4350+ dprintk(D_GENERIC, "%p %u,%u\n", tio, offset, size);
4351+ offset += tio->offset;
4352+
4353+ if (!(offset < tio->offset + tio->size) ||
4354+ !(offset + size <= tio->offset + tio->size)) {
4355+ eprintk("%u %u %u %u", offset, size, tio->offset, tio->size);
4356+ return -EIO;
4357+ }
4358+ assert(offset < tio->offset + tio->size);
4359+ assert(offset + size <= tio->offset + tio->size);
4360+
4361+ idx = offset >> PAGE_CACHE_SHIFT;
4362+ offset &= ~PAGE_CACHE_MASK;
4363+
4364+ conn->read_msg.msg_iov = conn->read_iov;
4365+ conn->read_size = size = (size + 3) & -4;
4366+ conn->read_overflow = 0;
4367+
4368+ i = 0;
4369+ while (1) {
4370+ assert(tio->pvec[idx]);
4371+ addr = page_address(tio->pvec[idx]);
4372+ assert(addr);
4373+ conn->read_iov[i].iov_base = addr + offset;
4374+ if (offset + size <= PAGE_CACHE_SIZE) {
4375+ conn->read_iov[i].iov_len = size;
4376+ conn->read_msg.msg_iovlen = ++i;
4377+ break;
4378+ }
4379+ conn->read_iov[i].iov_len = PAGE_CACHE_SIZE - offset;
4380+ size -= conn->read_iov[i].iov_len;
4381+ offset = 0;
4382+ if (++i >= ISCSI_CONN_IOV_MAX) {
4383+ conn->read_msg.msg_iovlen = i;
4384+ conn->read_overflow = size;
4385+ conn->read_size -= size;
4386+ break;
4387+ }
4388+
4389+ idx++;
4390+ }
4391+
4392+ return 0;
4393+}
4394+
4395+static void set_offset_and_length(struct iet_volume *lu, u8 *cmd, loff_t *off, u32 *len)
4396+{
4397+ assert(lu);
4398+
4399+ switch (cmd[0]) {
4400+ case READ_6:
4401+ case WRITE_6:
4402+ *off = ((cmd[1] & 0x1f) << 16) + (cmd[2] << 8) + cmd[3];
4403+ *len = cmd[4];
4404+ if (!*len)
4405+ *len = 256;
4406+ break;
4407+ case READ_10:
4408+ case WRITE_10:
4409+ case WRITE_VERIFY:
4410+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
4411+ (u32)cmd[4] << 8 | (u32)cmd[5];
4412+ *len = (cmd[7] << 8) + cmd[8];
4413+ break;
4414+ case READ_16:
4415+ case WRITE_16:
4416+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
4417+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
4418+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
4419+ (u64)cmd[8] << 8 | (u64)cmd[9];
4420+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
4421+ (u32)cmd[12] << 8 | (u32)cmd[13];
4422+ break;
4423+ default:
4424+ BUG();
4425+ }
4426+
4427+ *off <<= lu->blk_shift;
4428+ *len <<= lu->blk_shift;
4429+}
4430+
4431+static u32 translate_lun(u16 * data)
4432+{
4433+ u8 *p = (u8 *) data;
4434+ u32 lun = ~0U;
4435+
4436+ switch (*p >> 6) {
4437+ case 0:
4438+ lun = p[1];
4439+ break;
4440+ case 1:
4441+ lun = (0x3f & p[0]) << 8 | p[1];
4442+ break;
4443+ case 2:
4444+ case 3:
4445+ default:
4446+ eprintk("%u %u %u %u\n", data[0], data[1], data[2], data[3]);
4447+ break;
4448+ }
4449+
4450+ return lun;
4451+}
4452+
4453+static void send_r2t(struct iscsi_cmnd *req)
4454+{
4455+ struct iscsi_cmnd *rsp;
4456+ struct iscsi_r2t_hdr *rsp_hdr;
4457+ u32 length, offset, burst;
4458+ LIST_HEAD(send);
4459+
4460+ length = req->r2t_length;
4461+ burst = req->conn->session->param.max_burst_length;
4462+ offset = be32_to_cpu(cmnd_hdr(req)->data_length) - length;
4463+
4464+ do {
4465+ rsp = iscsi_cmnd_create_rsp_cmnd(req, 0);
4466+ rsp->pdu.bhs.ttt = req->target_task_tag;
4467+
4468+ rsp_hdr = (struct iscsi_r2t_hdr *)&rsp->pdu.bhs;
4469+ rsp_hdr->opcode = ISCSI_OP_R2T;
4470+ rsp_hdr->flags = ISCSI_FLG_FINAL;
4471+ memcpy(rsp_hdr->lun, cmnd_hdr(req)->lun, 8);
4472+ rsp_hdr->itt = cmnd_hdr(req)->itt;
4473+ rsp_hdr->r2t_sn = cpu_to_be32(req->r2t_sn++);
4474+ rsp_hdr->buffer_offset = cpu_to_be32(offset);
4475+ if (length > burst) {
4476+ rsp_hdr->data_length = cpu_to_be32(burst);
4477+ length -= burst;
4478+ offset += burst;
4479+ } else {
4480+ rsp_hdr->data_length = cpu_to_be32(length);
4481+ length = 0;
4482+ }
4483+
4484+ dprintk(D_WRITE, "%x %u %u %u %u\n", cmnd_itt(req),
4485+ be32_to_cpu(rsp_hdr->data_length),
4486+ be32_to_cpu(rsp_hdr->buffer_offset),
4487+ be32_to_cpu(rsp_hdr->r2t_sn), req->outstanding_r2t);
4488+
4489+ list_add_tail(&rsp->list, &send);
4490+
4491+ if (++req->outstanding_r2t >= req->conn->session->param.max_outstanding_r2t)
4492+ break;
4493+
4494+ } while (length);
4495+
4496+ iscsi_cmnds_init_write(&send);
4497+}
4498+
4499+static void scsi_cmnd_exec(struct iscsi_cmnd *cmnd)
4500+{
4501+ assert(!cmnd->r2t_length);
4502+
4503+ if (cmnd->lun) {
4504+ iscsi_scsi_queuecmnd(cmnd);
4505+ } else {
4506+ iscsi_device_queue_cmnd(cmnd);
4507+ }
4508+}
4509+
4510+static int nop_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
4511+{
4512+ u32 size, tmp;
4513+ int i, err = 0;
4514+
4515+ if (cmnd_ttt(cmnd) != cpu_to_be32(ISCSI_RESERVED_TAG)) {
4516+ cmnd->req = cmnd_find_hash(conn->session, cmnd->pdu.bhs.itt,
4517+ cmnd->pdu.bhs.ttt);
4518+ if (!cmnd->req) {
4519+ /*
4520+ * We didn't request this NOP-Out (by sending a
4521+ * NOP-In, see 10.18.2 of the RFC) or our fake NOP-Out
4522+ * timed out.
4523+ */
4524+ eprintk("initiator bug %x\n", cmnd_itt(cmnd));
4525+ err = -ISCSI_REASON_PROTOCOL_ERROR;
4526+ goto out;
4527+ }
4528+
4529+ del_timer_sync(&cmnd->req->timer);
4530+ clear_cmnd_timer_active(cmnd->req);
4531+ dprintk(D_GENERIC, "NOP-Out: %p, ttt %x, timer %p\n",
4532+ cmnd->req, cmnd_ttt(cmnd->req), &cmnd->req->timer);
4533+ }
4534+
4535+ if (cmnd_itt(cmnd) == cpu_to_be32(ISCSI_RESERVED_TAG)) {
4536+ if (!cmnd_immediate(cmnd))
4537+ eprintk("%s\n", "initiator bug!");
4538+ update_stat_sn(cmnd);
4539+ err = check_cmd_sn(cmnd);
4540+ if (err)
4541+ goto out;
4542+ } else if ((err = cmnd_insert_hash(cmnd)) < 0) {
4543+ eprintk("ignore this request %x\n", cmnd_itt(cmnd));
4544+ goto out;
4545+ }
4546+
4547+ if ((size = cmnd->pdu.datasize)) {
4548+ size = (size + 3) & -4;
4549+ conn->read_msg.msg_iov = conn->read_iov;
4550+ if (cmnd->pdu.bhs.itt != cpu_to_be32(ISCSI_RESERVED_TAG)) {
4551+ struct tio *tio;
4552+ int pg_cnt = get_pgcnt(size, 0);
4553+
4554+ assert(pg_cnt < ISCSI_CONN_IOV_MAX);
4555+ cmnd->tio = tio = tio_alloc(pg_cnt);
4556+ tio_set(tio, size, 0);
4557+
4558+ for (i = 0; i < pg_cnt; i++) {
4559+ conn->read_iov[i].iov_base
4560+ = page_address(tio->pvec[i]);
4561+ tmp = min_t(u32, size, PAGE_CACHE_SIZE);
4562+ conn->read_iov[i].iov_len = tmp;
4563+ conn->read_size += tmp;
4564+ size -= tmp;
4565+ }
4566+ } else {
4567+ for (i = 0; i < ISCSI_CONN_IOV_MAX; i++) {
4568+ conn->read_iov[i].iov_base = dummy_data;
4569+ tmp = min_t(u32, size, sizeof(dummy_data));
4570+ conn->read_iov[i].iov_len = tmp;
4571+ conn->read_size += tmp;
4572+ size -= tmp;
4573+ }
4574+ }
4575+ assert(!size);
4576+ conn->read_overflow = size;
4577+ conn->read_msg.msg_iovlen = i;
4578+ }
4579+
4580+out:
4581+ return err;
4582+}
4583+
4584+static u32 get_next_ttt(struct iscsi_session *session)
4585+{
4586+ u32 ttt;
4587+
4588+ if (session->next_ttt == ISCSI_RESERVED_TAG)
4589+ session->next_ttt++;
4590+ ttt = session->next_ttt++;
4591+
4592+ return cpu_to_be32(ttt);
4593+}
4594+
4595+static void scsi_cmnd_start(struct iscsi_conn *conn, struct iscsi_cmnd *req)
4596+{
4597+ struct iscsi_scsi_cmd_hdr *req_hdr = cmnd_hdr(req);
4598+
4599+ dprintk(D_GENERIC, "scsi command: %02x\n", req_hdr->scb[0]);
4600+
4601+ req->lun = volume_get(conn->session->target, translate_lun(req_hdr->lun));
4602+ if (!req->lun) {
4603+ switch (req_hdr->scb[0]) {
4604+ case INQUIRY:
4605+ case REPORT_LUNS:
4606+ break;
4607+ default:
4608+ eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
4609+ create_sense_rsp(req, ILLEGAL_REQUEST, 0x25, 0x0);
4610+ cmnd_skip_data(req);
4611+ goto out;
4612+ }
4613+ } else
4614+ set_cmnd_lunit(req);
4615+
4616+ switch (req_hdr->scb[0]) {
4617+ case SERVICE_ACTION_IN:
4618+ if ((req_hdr->scb[1] & 0x1f) != 0x10)
4619+ goto error;
4620+ case INQUIRY:
4621+ case REPORT_LUNS:
4622+ case TEST_UNIT_READY:
4623+ case SYNCHRONIZE_CACHE:
4624+ case VERIFY:
4625+ case VERIFY_16:
4626+ case START_STOP:
4627+ case READ_CAPACITY:
4628+ case MODE_SENSE:
4629+ case REQUEST_SENSE:
4630+ case RESERVE:
4631+ case RELEASE:
4632+ {
4633+ if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) {
4634+ /* unexpected unsolicited data */
4635+ eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
4636+ create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc);
4637+ cmnd_skip_data(req);
4638+ }
4639+ break;
4640+ }
4641+ case READ_6:
4642+ case READ_10:
4643+ case READ_16:
4644+ {
4645+ loff_t offset;
4646+ u32 length;
4647+
4648+ if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) {
4649+ /* unexpected unsolicited data */
4650+ eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
4651+ create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc);
4652+ cmnd_skip_data(req);
4653+ break;
4654+ }
4655+
4656+ set_offset_and_length(req->lun, req_hdr->scb, &offset, &length);
4657+ req->tio = tio_alloc(get_pgcnt(length, offset));
4658+ tio_set(req->tio, length, offset);
4659+ break;
4660+ }
4661+ case WRITE_6:
4662+ case WRITE_10:
4663+ case WRITE_16:
4664+ case WRITE_VERIFY:
4665+ {
4666+ struct iscsi_sess_param *param = &conn->session->param;
4667+ loff_t offset;
4668+ u32 length;
4669+
4670+ req->r2t_length = be32_to_cpu(req_hdr->data_length) - req->pdu.datasize;
4671+ req->is_unsolicited_data = !(req_hdr->flags & ISCSI_CMD_FINAL);
4672+ req->target_task_tag = get_next_ttt(conn->session);
4673+
4674+ if (LUReadonly(req->lun)) {
4675+ create_sense_rsp(req, DATA_PROTECT, 0x27, 0x0);
4676+ cmnd_skip_data(req);
4677+ break;
4678+ }
4679+
4680+ if (!param->immediate_data && req->pdu.datasize)
4681+ eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
4682+
4683+ if (param->initial_r2t && !(req_hdr->flags & ISCSI_CMD_FINAL))
4684+ eprintk("%x %x\n", cmnd_itt(req), req_hdr->scb[0]);
4685+
4686+ if (req_hdr->scb[0] == WRITE_VERIFY && req_hdr->scb[1] & 0x02)
4687+ eprintk("Verification is ignored %x\n", cmnd_itt(req));
4688+
4689+ set_offset_and_length(req->lun, req_hdr->scb, &offset, &length);
4690+ if (cmnd_write_size(req) != length)
4691+ eprintk("%x %u %u\n", cmnd_itt(req), cmnd_write_size(req), length);
4692+
4693+ req->tio = tio_alloc(get_pgcnt(length, offset));
4694+ tio_set(req->tio, length, offset);
4695+
4696+ if (req->pdu.datasize) {
4697+ if (cmnd_recv_pdu(conn, req->tio, 0, req->pdu.datasize) < 0)
4698+ assert(0);
4699+ }
4700+ break;
4701+ }
4702+ error:
4703+ default:
4704+ eprintk("Unsupported %x\n", req_hdr->scb[0]);
4705+ create_sense_rsp(req, ILLEGAL_REQUEST, 0x20, 0x0);
4706+ cmnd_skip_data(req);
4707+ break;
4708+ }
4709+
4710+out:
4711+ return;
4712+}
4713+
4714+static void data_out_start(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
4715+{
4716+ struct iscsi_data_out_hdr *req = (struct iscsi_data_out_hdr *)&cmnd->pdu.bhs;
4717+ struct iscsi_cmnd *scsi_cmnd = NULL;
4718+ u32 offset = be32_to_cpu(req->buffer_offset);
4719+
4720+ update_stat_sn(cmnd);
4721+
4722+ cmnd->req = scsi_cmnd = cmnd_find_hash(conn->session, req->itt, req->ttt);
4723+ if (!scsi_cmnd) {
4724+ eprintk("unable to find scsi task %x %x\n",
4725+ cmnd_itt(cmnd), cmnd_ttt(cmnd));
4726+ goto skip_data;
4727+ }
4728+
4729+ if (scsi_cmnd->r2t_length < cmnd->pdu.datasize) {
4730+ eprintk("invalid data len %x %u %u\n",
4731+ cmnd_itt(scsi_cmnd), cmnd->pdu.datasize, scsi_cmnd->r2t_length);
4732+ goto skip_data;
4733+ }
4734+
4735+ if (scsi_cmnd->r2t_length + offset != cmnd_write_size(scsi_cmnd)) {
4736+ eprintk("%x %u %u %u\n", cmnd_itt(scsi_cmnd), scsi_cmnd->r2t_length,
4737+ offset, cmnd_write_size(scsi_cmnd));
4738+ goto skip_data;
4739+ }
4740+
4741+ scsi_cmnd->r2t_length -= cmnd->pdu.datasize;
4742+
4743+ if (req->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) {
4744+ /* unsolicited burst data */
4745+ if (scsi_cmnd->pdu.bhs.flags & ISCSI_FLG_FINAL) {
4746+ eprintk("unexpected data from %x %x\n",
4747+ cmnd_itt(cmnd), cmnd_ttt(cmnd));
4748+ goto skip_data;
4749+ }
4750+ }
4751+
4752+ dprintk(D_WRITE, "%u %p %p %p %u %u\n", req->ttt, cmnd, scsi_cmnd,
4753+ scsi_cmnd->tio, offset, cmnd->pdu.datasize);
4754+
4755+ if (cmnd_recv_pdu(conn, scsi_cmnd->tio, offset, cmnd->pdu.datasize) < 0)
4756+ goto skip_data;
4757+ return;
4758+
4759+skip_data:
4760+ cmnd->pdu.bhs.opcode = ISCSI_OP_DATA_REJECT;
4761+ cmnd_skip_pdu(cmnd);
4762+ return;
4763+}
4764+
4765+static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd);
4766+
4767+static void data_out_end(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
4768+{
4769+ struct iscsi_data_out_hdr *req = (struct iscsi_data_out_hdr *) &cmnd->pdu.bhs;
4770+ struct iscsi_cmnd *scsi_cmnd;
4771+ u32 offset;
4772+
4773+ assert(cmnd);
4774+ scsi_cmnd = cmnd->req;
4775+ assert(scsi_cmnd);
4776+
4777+ if (conn->read_overflow) {
4778+ eprintk("%x %u\n", cmnd_itt(cmnd), conn->read_overflow);
4779+ assert(scsi_cmnd->tio);
4780+ offset = be32_to_cpu(req->buffer_offset);
4781+ offset += cmnd->pdu.datasize - conn->read_overflow;
4782+ if (cmnd_recv_pdu(conn, scsi_cmnd->tio, offset, conn->read_overflow) < 0)
4783+ assert(0);
4784+ return;
4785+ }
4786+
4787+ if (req->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) {
4788+ if (req->flags & ISCSI_FLG_FINAL) {
4789+ scsi_cmnd->is_unsolicited_data = 0;
4790+ iscsi_session_push_cmnd(scsi_cmnd);
4791+ }
4792+ } else {
4793+ /* TODO : proper error handling */
4794+ if (!(req->flags & ISCSI_FLG_FINAL) && scsi_cmnd->r2t_length == 0)
4795+ eprintk("initiator error %x\n", cmnd_itt(scsi_cmnd));
4796+
4797+ if (!(req->flags & ISCSI_FLG_FINAL))
4798+ goto out;
4799+
4800+ scsi_cmnd->outstanding_r2t--;
4801+
4802+ if (scsi_cmnd->r2t_length == 0)
4803+ assert(list_empty(&scsi_cmnd->pdu_list));
4804+
4805+ iscsi_session_push_cmnd(scsi_cmnd);
4806+ }
4807+
4808+out:
4809+ iscsi_cmnd_remove(cmnd);
4810+ return;
4811+}
4812+
4813+static void __cmnd_abort(struct iscsi_cmnd *cmnd)
4814+{
4815+ if (cmnd_rxstart(cmnd))
4816+ set_cmnd_tmfabort(cmnd);
4817+
4818+ if (cmnd_waitio(cmnd))
4819+ return;
4820+
4821+ if (cmnd->conn->read_cmnd != cmnd)
4822+ cmnd_release(cmnd, 1);
4823+}
4824+
4825+static int cmnd_abort(struct iscsi_session *session, struct iscsi_cmnd *req)
4826+{
4827+ struct iscsi_task_mgt_hdr *req_hdr =
4828+ (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
4829+ struct iscsi_cmnd *cmnd;
4830+
4831+ u32 min_cmd_sn = req_hdr->cmd_sn - session->max_queued_cmnds;
4832+
4833+ req_hdr->ref_cmd_sn = be32_to_cpu(req_hdr->ref_cmd_sn);
4834+
4835+ dprintk(D_GENERIC, "cmd_sn(%u) ref_cmd_sn(%u) min_cmd_sn(%u) rtt(%x)"
4836+ " lun(%d) cid(%u)\n",
4837+ req_hdr->cmd_sn, req_hdr->ref_cmd_sn, min_cmd_sn, req_hdr->rtt,
4838+ translate_lun(req_hdr->lun), req->conn->cid);
4839+
4840+ if (after(req_hdr->ref_cmd_sn, req_hdr->cmd_sn))
4841+ return ISCSI_RESPONSE_FUNCTION_REJECTED;
4842+
4843+ if (!(cmnd = cmnd_find_hash(session, req_hdr->rtt, ISCSI_RESERVED_TAG))) {
4844+ if (between(req_hdr->ref_cmd_sn, min_cmd_sn, req_hdr->cmd_sn))
4845+ return ISCSI_RESPONSE_FUNCTION_COMPLETE;
4846+ else
4847+ return ISCSI_RESPONSE_UNKNOWN_TASK;
4848+ }
4849+
4850+ dprintk(D_GENERIC, "itt(%x) opcode(%x) scsicode(%x) lun(%d) cid(%u)\n",
4851+ cmnd_itt(cmnd), cmnd_opcode(cmnd), cmnd_scsicode(cmnd),
4852+ translate_lun(cmnd_hdr(cmnd)->lun), cmnd->conn->cid);
4853+
4854+ if (cmnd_opcode(cmnd) == ISCSI_OP_SCSI_TASK_MGT_MSG)
4855+ return ISCSI_RESPONSE_FUNCTION_REJECTED;
4856+
4857+ if (translate_lun(cmnd_hdr(cmnd)->lun) !=
4858+ translate_lun(req_hdr->lun))
4859+ return ISCSI_RESPONSE_FUNCTION_REJECTED;
4860+
4861+ if (cmnd->conn && test_bit(CONN_ACTIVE, &cmnd->conn->state)) {
4862+ if (cmnd->conn->cid != req->conn->cid)
4863+ return ISCSI_RESPONSE_FUNCTION_REJECTED;
4864+ } else {
4865+ /* Switch cmnd connection allegiance */
4866+ }
4867+
4868+ __cmnd_abort(cmnd);
4869+
4870+ return ISCSI_RESPONSE_FUNCTION_COMPLETE;
4871+}
4872+
4873+static int target_reset(struct iscsi_cmnd *req, u32 lun, int all)
4874+{
4875+ struct iscsi_target *target = req->conn->session->target;
4876+ struct iscsi_session *session;
4877+ struct iscsi_conn *conn;
4878+ struct iscsi_cmnd *cmnd, *tmp;
4879+ struct iet_volume *volume;
4880+
4881+ list_for_each_entry(session, &target->session_list, list) {
4882+ list_for_each_entry(conn, &session->conn_list, list) {
4883+ list_for_each_entry_safe(cmnd, tmp, &conn->pdu_list, conn_list) {
4884+ if (cmnd == req)
4885+ continue;
4886+
4887+ if (all)
4888+ __cmnd_abort(cmnd);
4889+ else if (translate_lun(cmnd_hdr(cmnd)->lun)
4890+ == lun)
4891+ __cmnd_abort(cmnd);
4892+ }
4893+ }
4894+ }
4895+
4896+ list_for_each_entry(volume, &target->volumes, list) {
4897+ if (all || volume->lun == lun) {
4898+ /* force release */
4899+ volume_release(volume, 0, 1);
4900+ /* power-on, reset, or bus device reset occurred */
4901+ ua_establish_for_all_sessions(target, volume->lun,
4902+ 0x29, 0x0);
4903+ }
4904+ }
4905+
4906+ return 0;
4907+}
4908+
4909+static void task_set_abort(struct iscsi_cmnd *req)
4910+{
4911+ struct iscsi_session *session = req->conn->session;
4912+ struct iscsi_conn *conn;
4913+ struct iscsi_cmnd *cmnd, *tmp;
4914+
4915+ list_for_each_entry(conn, &session->conn_list, list) {
4916+ list_for_each_entry_safe(cmnd, tmp, &conn->pdu_list, conn_list) {
4917+ if (translate_lun(cmnd_hdr(cmnd)->lun)
4918+ != translate_lun(cmnd_hdr(req)->lun))
4919+ continue;
4920+
4921+ if (before(cmnd_hdr(cmnd)->cmd_sn,
4922+ cmnd_hdr(req)->cmd_sn))
4923+ __cmnd_abort(cmnd);
4924+ }
4925+ }
4926+}
4927+
4928+static inline char *tmf_desc(int fun)
4929+{
4930+ static char *tmf_desc[] = {
4931+ "Unknown Function",
4932+ "Abort Task",
4933+ "Abort Task Set",
4934+ "Clear ACA",
4935+ "Clear Task Set",
4936+ "Logical Unit Reset",
4937+ "Target Warm Reset",
4938+ "Target Cold Reset",
4939+ "Task Reassign",
4940+ };
4941+
4942+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
4943+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
4944+ fun = 0;
4945+
4946+ return tmf_desc[fun];
4947+}
4948+
4949+static inline char *rsp_desc(int rsp)
4950+{
4951+ static char *rsp_desc[] = {
4952+ "Function Complete",
4953+ "Unknown Task",
4954+ "Unknown LUN",
4955+ "Task Allegiant",
4956+ "Failover Unsupported",
4957+ "Function Unsupported",
4958+ "No Authorization",
4959+ "Function Rejected",
4960+ "Unknown Response",
4961+ };
4962+
4963+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
4964+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
4965+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
4966+ rsp = 8;
4967+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
4968+ rsp = 7;
4969+
4970+ return rsp_desc[rsp];
4971+}
4972+
4973+static void execute_task_management(struct iscsi_cmnd *req)
4974+{
4975+ struct iscsi_conn *conn = req->conn;
4976+ struct iscsi_session *session = conn->session;
4977+ struct iscsi_target *target = session->target;
4978+ struct iscsi_cmnd *rsp;
4979+ struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
4980+ struct iscsi_task_rsp_hdr *rsp_hdr;
4981+ u32 lun;
4982+ int function = req_hdr->function & ISCSI_FUNCTION_MASK;
4983+
4984+ rsp = iscsi_cmnd_create_rsp_cmnd(req, 1);
4985+ rsp_hdr = (struct iscsi_task_rsp_hdr *)&rsp->pdu.bhs;
4986+
4987+ rsp_hdr->opcode = ISCSI_OP_SCSI_TASK_MGT_RSP;
4988+ rsp_hdr->flags = ISCSI_FLG_FINAL;
4989+ rsp_hdr->itt = req_hdr->itt;
4990+ rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
4991+
4992+ switch (function) {
4993+ case ISCSI_FUNCTION_ABORT_TASK:
4994+ case ISCSI_FUNCTION_ABORT_TASK_SET:
4995+ case ISCSI_FUNCTION_CLEAR_ACA:
4996+ case ISCSI_FUNCTION_CLEAR_TASK_SET:
4997+ case ISCSI_FUNCTION_LOGICAL_UNIT_RESET:
4998+ lun = translate_lun(req_hdr->lun);
4999+ if (!volume_lookup(target, lun)) {
5000+ 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: