06/19/2006 John Donnelly. Tagged top of tree 1.7.0. Updated README to reflect the default build is 2.6.x kernels instead of 2.4. Build and posted new tarball for 1.7.0. 05/16/06 Bob Russell - modify the files command files cmd/ini-manage, cmd/ini-conn-up, cmd/ini-lun-up, and cmd/ini-lun-down so that they will adjust automatically to the host number assigned by the scsi subsystem to the initiator module when it is loaded. This number is monotonically increasing with each new scsi HBA loaded, so loading, unloading and then reloading the iscsi initiator will cause it to be assigned different host numbers on each load. 05/15/06 Bob Russell - in iscsi_target.c, moved called to tcp_reuse_port() so it is done before calling bind(), not after, so that the address now really is quickly reused. Thanks to xiguiwang for finding and reporting this. - compiled and tested with kernels through 2.6.15.7 -- all ok, even though the typedef for Scsi_Host_Template disappeared in 2.6.15 and now has to be supplied in iscsi_initiator.c. Note: did not try any 2.6.16 kernels because they are turning over at an incredible rate -- the first version (2.6.16) came out on the morning of 20 March 2006, the most recent version (2.6.16.16) came out on the morning of 11 May 2006 (yesterday). That is 17 versions in 52 days, or a new version every 3 days!!! Who has time to keep up with that?!- in iscsi_target.c, removed irqsave/irqrestore from all uses of session_rwlock. This fixes a bug in function search_iscsi_cmnd() in which, on exit from a successful search, irqs were incorrectly enabled and "flags" parameter was set incorrectly to disable them. It also fixes warnings due to calls to down_interruptible() when terminating threads abnormally in iscsi_release_connection() and iscsi_release_session(). - in iscsi_target.c, changed KERNEL_VERSION(2,6,10) to KERNEL_VERSION(2,6,9) around (&in_dev->lock) because this structure no longer has a lock field. 12/28/05 Bob Russell - numerous changes of "char" to "unsigned char" or "__u8", "int" to "u32", etc. to eliminate warnings about signedness from new version of gcc. However, the library still generates warnings! - in attach_pending_command() in initiator_utilities.c, added "case 3:" to handle a situation when a target rejects a Text Command and the CmdSN is not advanced by the target -- the call to use this is at the end of resend_text_request() in initiator_rx.c. 10/14/05 Bob Russell - changes to iscsi_target.c to better manage the command window, especially when commands are aborted -- added field need_max_cmd_sn_inc to struct iscsi_cmnd and all the code that uses this field. - many changes to initiator to change way commands are aborted, so that now the midlevel thread (scsi_eh_1) that calls iscsi_initiator_abort() does not do a "down" on a semaphore to wait for target to reply to a task management function request. Rather, the aborted command is terminated immediately in iscsi_initiator_abort() after queuing up the send of the TM request. 07/22/05 Bob Russell - in initiator, fixed another bug when an error occurs during session startup. - in initiator, added "force R" to /proc input which allows a terminating rx thread to restart the session when ERL <= 1. - in iscsi_target.c, added states AWAIT_BUFFER and AWAIT_BUFFER_QUEUE to make it easier to see in debug printouts that a command is waiting for memory. - in scsi_target.c, eliminated use of GFP_DMA in all get_free_page() calls. - in iscsi_target.c, fixed bug in handle_login() caused when a late error is detected -- can't try to send a login reject with lock held! - in initiator_utilities, added function sg_map() to encapsulate 2.4/2.6 handling of scatter-gather vectors. Also (temporarily) stopped trying to use sendpage() in 2.6 kernels, due to ongoing problems. - small cleanups in srp.c -- added TRACE_SRP debugging. - fixed bug in iscsi_target in computing R2T offsets when sequences are not InOrder. - add conditional definition of irqs_disabled() to iscsi_common.h. This seems to be defined in the file in 2.6 kernels, and in 2.4 kernels doctored by RedHat, but not in "clean" 2.4 kernels. - cleaned up removal of /proc files to remove BADNESS during error recovery. - fixed bug in initiator so that session recovery is not attempted unless a disconnected connection is in full feature phase - reorganized handling of immediate data and unsolicited DataOut pdus in iscsi_target.c. Got rid of unsolicited_data_sem and the waits on it, which blocked the rx thread. Instead now have all immediate data and unsolicited DataOut pdus go through the preallocated ubufs, even if the command is in-order. This means all unsolicited data incurs an extra copy, but it ensures that the rx_thread is never blocked waiting for the mid-level to allocate memory, a combination that on low-memory targets could cause a deadlock. - changed calculation for number of udata buffers to preallocate. - added test for DataOut DSL = 0 in read_list_data_seg() in iscsi_target.c. - changed most spin_lock() calls to spin_lock_irqsave() in iscsi_target.c. - added TRACE_SEM debugging whenever tx_sem was "upped" in iscsi_target.c. - changed most kmalloc() from GFP_KERNEL to GFP_ATOMIC in target. - added more debugging in scsi_target.c. - added conditional defines for SCSI_DATA_XXX to scsi_target.h and iscsi_initiator.h since 2.6.12 kernel no longer defines them. 06/21/05 Bob Russell - added lock_and_check_and_update_cmd_sns() in initiator_utilitites.c, and modified common/initiator_negotiate.c to call it so that the ExpCmdSN and MaxCmdSN fields in all Login Response PDUs are processed properly. - added comments to fields in definition of struct iscsi_global in file common/target_negotiate.h. - changed iscsi_target.c to correctly initialize and restore the following fields in struct iscsi_global: max_queue_depth_allowed, phase_collapse, auth_parameter. - added phase_collapse field to struct iscsi_conn and modified send_read_data() in iscsi_target.c to use that field to test and toggle phase collapse (instead of the phase_collapse field in devdata, which is now used only to configure the p= option from iscsi_manage). - minor change to handle_login() in iscsi_target.c to print the final value of all parameters after a successful login when TRACE_ISCSI_FULL is on. 05/27/05 Bob Russell - added Q= option to set max size of command window on target (i.e., the queue depth). Default is QUEUE_DEPTH_ALLOWED (4). Field is max_queue_depth_allowed. - changed timer on target to run continuously, then use it not only for user requested NopIn pings, but also for automatic generation of NopIn pings when commands have been in the ISCSI_SENT state for too long. It does this by periodically waking up the tx-thread. Also added NOP_TIME_LIMIT, TIMER_PERIOD and PING_REPLY_TIME_LIMIT to control this, and fields nop_period_remaining, time_stamp, and time_last_nopin)sent. - changed trace output on target to print jiffies in most cases. - changed names of symbolic constants for ATTR field values by adding _ATTR_. 05/12/05 Bob Russell - in scsi_target.c, added free_cmd_queue to Target_Emulator and changed rx_cmnd() to try to get a free Target_Scsi_Cmnd from that list. If the list is empty, then allocate a new Target_Scsi_Cmnd and bump the counter total_commands in Target_Emulator. Commands are moved to free_cmd_queue from cmd_queue in scsi_target_process_thread() when it finds them in the ST_DEQUEUE state. Commands on free_cmd_queue are actually freed in scsi_target_cleanup_module(), when total_commands is also printed. - in scsi_target.c, added an st_list[] array to Target_Scsi_Cmnd and changed get_space() to use that when it is big enough. Because of the allocation strategy in get_space(), "big enough" usually requires just 1 array element! If this is not big enough, st_list is dynamically allocated to the right size. - in scsi_target.c, changed get_space() so that it allocates blocks of contiguous pages that are "just" the right size for the request (unless the request is bigger than the maximum contiguous block, in which case multiple maximum contiguous blocks will be allocated). - in scsi_target.c, changed MEMORYIO so that for READ/WRITE buffers, one permanently allocated block of pages is reused for everything. - in iscsi_target.c, changed session's "coded-out" cmnd_list to a "struct list_head" active_command_list threaded thru command_link field in struct iscsi_cmnd. - in iscsi_target.c, changed method of releasing commands so that: a. they are now normally released as soon as they go into state ISCSI_DEQUEUE b. commands in the ISCSI_DEQUEUE state are first threaded onto a dequeue_list (while the lock is held), then the list items are released without the lock being held, and finally the dequeue_list is spliced onto the session's free_command_list (with the lock held again). - in iscsi_target.c, folded check_cmd_sn() into get_free_command() to form just one common critical section. - in scsi_target.c, added MAX_IOV_SLOTS and tx_iov[] and tx_iov_copy[] fields to iscsi_cmnd so that fill_and_send_datain_iov() no longer has to malloc its iov array, but will just use these arrays in the command structure. Similarly, added rx_iov[] and rx_iov_copy[] fields to iscsi_cmnd so that read_list_data_seq() no longer has to malloc its iov array. - in iscsi_target.c, introduced session-wide list of preallocated free command structs, and all the "free_command(s)" routines and calls to used them. So far, NOP, TEXT, and LOGOUT have been converted to use these routines. - modified out-of-order unsolicited data handling in iscsi_target.c so buffers are preallocated at session startup in order to prevent running out of memory during operation when sizes are large (131072 bytes). This new/modified code is all the "udata" and "unsolicited_buffer(s)" stuff. Also shrank command window on target (QUEUE_DEPTH_ALLOWED) to 8 commands, since need to preallocate at least one buffer for each command (more if possible FirstBurstSize is bigger than 131072). Note these preallocated buffers are used only for SCSI data (i.e., Immediate WRITE data and unsolicited DataOut pdu data), not for data in a text or nop command. - modified ack_sent_cmnds() in iscsi_target.c to detect and delete commands with duplicate ITT already queued. - modified most kmalloc() calls to be GFP_ATOMIC in order to remove race condition in scsi_target.c when out of memory. - modified initiator's struct session so the oper_param structure is now part of struct session rather than being pointed to by struct session. This saves the kmalloc() and kfree() for oper_param, and also saves an extra pointer dereference on each reference to a field in oper_param. - started to use char xxx_word[]= "xxx" for common strings that are shared in several places, so the text will only be stored once in memory. - generalized and moved parse_text_buffer() into new file, common/ffp_negotiate.{c,h}, so it could be used for text negotiations in FFP by both initiator and target. - added function release_command() in iscsi_target.c and calls to it in appropriate places so always free everything in struct iscsi_cmnd. - added code in target to reject unacceptible commands in Discovery session. - added 2 new tests, mrdsl and mrdsli, to initiator_proc_iface.c and iscsi_test.c, to allow user to trigger initiator text negotiation to send new MRDSL value from initiator to target. - added code in generate_text_response() and parse_text_buffer() in iscsi_target.c to handle keys in text negotiation and to allow changing of MaxRecvDataSegmentLength during Normal session. - added code in target to deal with Logout Request Reason and Logout Response response in some cases. - in common/iscsi_common.h added LOGOUT_RESPONSE_xxx codes, per 10.15.1. - modified drive_text_negotiate() in initiator_rx.c to enable it to send new MaxRecvDataSegmentLength value to target in Text Negotiations in FFP of Normal Session - added field new_max_recv_length in struct command in iscsi_initiator.h to hold new value of MaxRecvDataSegmentLength sent to target during Text Negotiations in FFP of Normal Session until the Negotiations are finalized during processing of final Text Response in rx_text_rsp() in initiator_rx.c. This field is set in drive_text_negotiate() in initiator_rx.c. 05/27/05 Bob Russell - undo previous changes for attr field and instead add add lun_attr array to struct session in iscsi_initiator.h. This is used in iscsi_initiator.c to initialize the ATTR field of each SCSI Command PDU. It is set from the data received by an INQUIRY command, on a per-LUN basis. Also added lun field to struct command in iscsi_initiator.h. 05/25/05 Bob Russell - add attr field to struct session and struct iscsi_targetdata in iscsi_initiator.h. This is used in iscsi_initiator.c to initialize the ATTR field of a SCSI Command PDU. It is set via iscsi_manage using "init force attr=1" for example, where the number must be in the range 0 to 7 inclusive (0 is the default). 04/20/05 Bob Russell - in iscsi_target.c, function send_iscsi_response(), fixed bug in sending of sense data on iSCSI Response PDU. - in scsi_target.c, function scsi_target_cleanup_module(), added mutex protection around freeing all items in target_map_list (DISKIO mode only) 04/19/05 Bob Russell - as suggested by Charles Coffing, broke bring_down_portals() in file iscsi_target.c into two parts in order to avoid a race during target shutdown. Added new function release_portals() to do this. 4/18/05 Bob Russell - applied patches contributed by Charles Coffing to fix some error path cleanups and leaks of /proc entries in target. Files scsi_target.h, scsi_target.c and scsi_target_module.c were changed. 03/29/05 Bob Russell - added code in initiator to send STATUS SNACK when a data digest error is detected on a Text Response PDU or a NopIn PDU. - added code in target to retransmit a Text Response PDU or NopIn PDU if a STATUS SNACK for it is received. To deal with this, added new states ISCSI_RESEND_TEXT_RESPONSE and ISCSI_RESEND_NOP_IN, plus new fields in struct iscsi_cmnd that all have names reply_xxxx. Also merged ask_for_more_data() into handle_discovery_rsp(). - added 2 options for setting A_bit: a=y (DATACK1_SNACK_ENABLE) to set A bit on DataIn pdus that end a sequence that is NOT the last sequence in the command, and A=y (DATACK2_SNACK_ENABLE) to set A bit on DataIn pdus that end the last sequence in the command. They can be used together or independently, since there is no overlap. Before it will send more DataIns, the target waits to receive the DATACK SNACK after setting the A bit at the end of a sequence that does not end the command; it does not wait at the end of the command. Introduced 3 new target states: ISCSI_AWAIT_DATA_ACK, ISCSI_GOT_DATA_ACK, and ISCSI_REDO_DATA to account for this wait. Also had to move some variables into the struct iscsi_cmnd from send_read_data() to preserve them during the wait. This simplified do_command_status(). Also added search_by_ttt() so receipt of the DATACK SNACK could find the waiting command and change its state. 03/28/05 Bob Russell - fix bug in initiator found by Ming Zhang. In function iscsi_initiator_login() in file iscsi_initiator.c, modified the way failure name and address are saved so that storage is allocated outside of the locked critical section, thus avoiding an invalid context oops. 03/25/05 Bob Russell - fix race condition in target found by Ming Zhang. Added new semaphore sock_sem to struct iscsi_conn in common/target_negotiate.h. Added use of this in function iscsi_release_socket() in target/iscsi_target.c. ..... END OF 1.7.0 CHANGES 02/20/05 John Donnelly - Tarball for RPM 1.6.0. This components builds and works successfully on 2.4.29 and 2.6.10 kernels from www.kernel.org. Incremential kernels distrubuted on distros like Redhat and SuSe are too annoying with to spent time debugging. Specifically: 2.4.20-xxx from RedHat 9 complain about unresolved malloc_size and __kmalloc() symbols when the ush_iscsi_target.o driver loads, 2.6.5-xx and 2.6.9-xx kernels fail to build due to structure changes in the SCSI header files. 02/03/05 Bob Russell - in common/tcp_utilities.c, had to make call to sock_getsockopt() dependent on kernel version, because this symbol used to be exported prior to 2.6.10 but is not in 2.6.10 (althought sock_setsockopt() is exported), yet it is needed when the level parameter is SOL_SOCKET. - added fixes contributed by Charles Coffing (ccoffing at novell dot com) to track changes to the socket interface introduced in 2.6.10 kernel. In target/iscsi_target.c, had to make call to sock_alloc() dependent on kernel version, because with 2.6.10 it is no longer exported, and call to new function sock_create_kern() has to be used instead. - as contributed by Charles Coffing, added KERNEL_VER to Makefile-26 to make it possible to compile for a different kernel than the running kernel. - changes in target_error_rec.c to integrate recovery R2Ts correctly into monotonically increasing R2TSN numbering. - changes in initiator_rx file so initiator can recover its way through losses of any SCSI Command, R2T, DataOut or Response pdu in a WRITE. - fixed do_iscsi_response() in initiator_utilities.s so detection of any non-zero status always sets CMD_STATE_TXDONE in command's cmd_state, and so warnings about a residual count mismatch are not given if status is non-zero. - modified initiator's handling of DataDigest error in rx_rjt() so that if the rejected pdu is a WRITE command, it is retransmitted at once. - added tx_data_length field to struct command to save length of data attached to a SCSI Command pdu or a DataOut pdu on a WRITE (for keeping stats) - modified initiator so that a DataIn with A bit set triggers retransmission of all preceeding errored DataIns and when those retransmissions are done, then send the ACK (i.e., don't wait until end of the READ, since a target expects the ACK immediately after the A bit and will not send any more DataIns until it gets this ACK). Had to add abit_xxx fields in command structure to save/restore fields from the DataIn with the A bit set across the retransmissions. Added send_data_ack_snack() to do all this. - fixed bug in ack_sent_cmnds() in file iscsi_target.c caused when cmnd parameter is NULL. - modified initiator_rx.c to resynchronize connection's exp_stat_sn when a scsi_response PDU is received with a stat_sn that is 1 too high. - modified initiator_rx.c to print info about received PDU earlier in the rx_thread loop (i.e., before most error messages about this PDU) - modified handle_snack() in target/iscsi_target.c to reject with "Protocol error" any SNACK of type DATA_R2T or STATUS that does not find the corresponding command in the proper state for retransmission (as required by RFC 3720 Section 10.16. last paragraph). - fixed bug in setting of ExpStatSN field in SNACKs of type Data/R2T. If the run in the SNACK included only DataIn pdus with S=0, then the ExpStatSN was being set to the StatSN in the DataIn with S=1 or in the SCSI Response that triggered sending the SNACK, but it should not advance to this until after all DataIn pdus have been received correctly. 01/21/05 Bob Russell - changed some #include files to eliminate redundancies and to conform to 2.6.10 without breaking 2.4 - added TMF_ in front of ABORT_TASK etc. #defines in both iscsi_common.h and scsi_target.h to avoid conflicts with identical symbols defined in 2.6.10 (that have different values!). Them modified all references to these symbols in the rest of the code. - modified print_expanded_address_any() in iscsi_target.c to handle locking in 2.6.10. 01/19/05 Bob Russell - modified scsi_target_proc_info to print info about configured targets. Added print_device_info() to help do this. - modified scsi_target.c so that in DISKIO mode, discovery of target scsi devices now keeps track of devices on different hosts and channels that have the same id. This is done by introducing target_map_list which is used by DISKIO with TRUSTCDB to keep a list of targets, instead of using the array target_map[] that is used in all other modes. - Made target_count globally accessible, because with introduction of target_map_list, MAX_TARGETS no longer applies in DISKIO mode. Modified references to it in iscsi_target.c accordingly. - modified initiator_proc_iface.c by encapsulating existing code to print the type of a scsi device into the static function printable_dev_type(). Then added that function to scsi_target.c and called it in add_one_scsi_device() and print_device_info(). 12/14/04 Bob Russell - modified initiator so request to logout a session really logs out all connections in the session if the reply from the target agrees. This required adding 2 new session_states: SESSION_LOGGED_OUT and SESSION_CLOSED. 12/06/04 Bob Russell - added counters to initiator's connection statistics to keep track of number of bytes sent/received per connection. - made a small change to iscsi_rx_thread() in target/iscsi_target.c so this rx_thread does not exit after receiving a logout request, thereby giving the iscsi_tx_thread() in the same file a chance to transmit the logout response. 11/29/04 Bob Russell - changed a number of debug printk() to TRACE() in target/iscsi_target.c. - updated cmd/ini-manage to make it easier to change the configuration settings - added cmd/ini-discovery to illustrate how to drive a discovery session - removed old files ini-m1, ini-m2, ini-manage-er, ini-ag, and ini-ag-c2-up from cmd directory. 11/24/04 Bob Russell - modified code in send_unsolicited_data() in file target/iscsi_target.c to fix a bug found and fixed by Chuck Simmons (charles.simmons@oracle.com). - Added functions get_sglen, get_sgbuf, and skip_thru_sg_list to iscsi_target.c and generally cleaned up code involving scatter-gather list handling. - added more info to the initiator's /proc/scsi/iscsi/target-x/stat display. This now shows the results of INQUIRY, READ CAPACITY and READ BLOCK LIMITS commands on a per lun basis. To do this, added new functions alloc_inquiry_stuff, free_inquiry_stuff, save_inquiry, save_capacity and save_limits to initiator_utilities.c; and new functions print_ascii, print_ver_descr, print_capacity_stuff, print_limits_stuff, and print_inquiry_stuff to initiator_proc_iface.c. Also reduced width of columns in /proc output to reduce the total number of output bytes. - added calls to free_inquiry_stuff() in iscsi_initiator.c, and cleaned up some code formatting and debug printouts in there too. - added arrays to struct session in iscsi_initiator.h to hold new info about inquiry, capacity and block limits commands on a per lun basis. - moved a check on conn->active in iscsi_tx_thread() in target/iscsi_target.c so the target has a chance to send a logout response before disconnecting, as suggested by Daren Hayward (darenh@4bridgeworks.com). - added code in iscsi_target.c (mangle_data()) contributed by Daren Hayward (darenh@4bridgeworks.com) to add the iscsi version descriptor value 0x0960 to the version descriptor area of INQUIRY response data, and other code to ensure correct setting of the residual count when underflow/overflow occurs. - in scsi_target.c, modified code in handle_cmd() to set timeout correctly for tape devices, contributed by Daren Hayward. - changed all places in iscsi_target.c and target_error_rec.c that do up(&conn->tx_sem) so that it is done only when the semaphore is already locked (to prevent the count from getting higher than 1, which causes useless wakeups). This eliminated the NEED_TX_WAKEUP_BIT in common/target_negotiate.h, and all references to it in the target directory. - added code in iscsi_target.c to turn on debug printing while servicing a task management command. - improved some tracing messages in target/iscsi_target.c and in initiator/initiator_rx.c 09/17/04 Bob Russell - added -fsigned-char to Rules.make and Makefile-26 at the suggestion of Daren Hayward (darenh@4bridgeworks.com), so that "char" will be signed on all platforms, as it is by default on x86 platforms. - added file docs/TARGET_TASK_MAN which walks through how a TASK MANAGEMENT command is handled on the target side. - in target/scsi_target.c, changed many error messages to be more consistent and informative, made some small changes to task management handling. - in target/iscsi_target.c, made some small changes to task management handling. - added file docs/TARGET_READ which walks through how a SCSI READ command is handled on the target side, showing the interaction of the threads, the states and state transitions, and the functions called. - in target/iscsi_target.c, reorganized handling of sense data in SCSI Response pdus. Added new functions do_command_status() and send_read_data(), and calls to them in revised send_iscsi_response() and handle_iscsi_done(). In the process, fixed a few bugs and made the code more general. - fixed bug in target/iscsi_target.c, function handle_snack(), caused by not calling ack_sent_cmnds() to use the ExpStatSN field of the SNACK pdu to ack SENT commands. - fixed bug in initiator/initiator_rx.c, function rx_async_msg(), and in common/iscsi_common.c, function print_targ_async_msg(), caused by not converting network byte order to host byte order for the parameterx fields. - fixed cut-and-paste error in target/iscsi_target.c, function do_task_mgt(). 09/03/04 Bob Russell - modified Makefile-26 to eliminate loader errors for 2.6 kernels. - modified initiator/initiator_utilities.c to eliminate compiler warnings for 2.6 kernels. - in initiator/initiator_proc_iface.c, eliminated unnecessary dynamic memory allocation for local "dir_name" buffer in add_iscsi_proc_entry() and remove_iscsi_proc_entry(). - in target/iscsi_target.c, put back "init_timer(&conn->nop_timer);" in build_conn_sess() to remove run-time warning in 2.6 kernels. 08/27/04 Bob Russell - added the file docs/TARGET_TEXT_NEGO to document the various cases the target must handle during text negotiations. - modified docs/iscsi_manage.8 to document the new "force" options: tk1, isidt, isidtn and isidq. - modified common/target_negotiate.c by adding finalize_new_session() and call to it just before sending back the last Login Response before going into full feature phase, in order to check the I_T nexus of a new session (tsih=0) to release any existing session with same nexus and to assign a unique tsih. Also added print_isid_tsih_message() as a utility function. - modified initiator by adding 3 new fields in struct iscsi_targetdata: isid_type, isid_number and isid_qualifier; by adding code in initiator_proc_iface to allow user to force these values via iscsi_manage with force values isidt, isidn and isidq respectively; by adding setup_isid(), which uses the new fields to setup the isid in a Login Request pdu, and the call to it in iscsi_initiator.c, and by changing a few parameters of existing routines to pass the target data pointer into setup_isid(). Also modified iscsi_manage.c to deal with these 3 new force options. - minor changes everywhere so tsih is now always __u16. - modified common/initiator_negotiate.c and scan_table_and_process() in common/text_param.c so that initiator does not require the target to return TargetPortalGroupTag when it has not sent TargetName on a Discovery session. - modified check_flags() in target_negotiate.c to turn off the sending of TargetPortalGroupTag when TargetName is not given (in a Discovery session only), and to force the sending of TargetPortalGroupTag whenever TargetName is given. - added general print_iscsi_command() and printable_iscsi_op() to common/iscsi_common.c, then changed initiator's rx and tx threads to make one general call to these routines before dispatching on opcode, which eliminates specialized calls for "Send" and "Got" on each opcode. - in initiator_rx.c, added accumulate_text() and calls to it in rx_text_rsp() in order to handle Text Response pdus with C=1. - in initiator_tx.c, set I-bit in Logout pdus so they "jump the queue" of any pending commands and are not held up by the beyond_window() check. - in iscsi_target.c, added code to really parse keys in text data and to respond correctly to the different variations of SendTargets= in both Normal and Discovery sessions. Also added appropriate rejects for errors, and check to ensure only 1 text command in progress per connection. Also, added code in target to deal with C=1 continuations of both Text Requests from initiator and Text Replies generated by target. In iscsi_target.c, changed name of handle_discovery() to handle_text_request(). Added routines do_text_request(), accmulate_text_inpu(), copy_in_progress_stuff(), and ask_for_more_text(). Also added text_in_progress field to struct iscsi_conn, and in_progress_buffer to struct iscsi_cmnd. Finally, added new command states ISCSI_ASK_FOR_MORE_TEXT, ISCSI_AWAIT_FOR_MORE_TEXT, and ISCSI_BLOCKED_SENDING_TEXT. Also modified iscsi_proc_info() and iscsi_manage.c to accept the tk1 key for targets only which forces the target to reply to an initiator SendTarget Request by sending only 1 key per text response, with C=0, F=0. - cleaned up code to remove compile-time warnings in 2.6 kernel. - in initiator added check on incoming PDUs to ensure their ExpCmdSN is greater than the CmdSN of the command to which they are replying. - added #include to all modules (needed by 2.6 kernels). 08/17/04 Bob Russell - in scsi_target.c, fixed bug in scsi_target_procss_thread() when dequeueing a command so that now the req field is not freed if it is NULL. - in initiator_tx.c, add beyond_window() and finalize_header() and calls to them to fix bug in handling R2Ts and ExpStatSn when target shuts down the command window. Also add header_complete flag to struct command that is set after finalize_header has completed. - in initiator, add basic_hdr_len field to struct connection, set it up once immediately after successful login to include CRC_LEN if necessary, then use that throughout to initialize iov_len of first iovector slot. - in initiator_utilities.c, changed type of second parameter to setup_command() and modified all calls to it appropriately. - in initiator_utilities.c, added connection parameter to setup_header_iovec() and modified all calls to it appropriately. - general cleanup of code around sizeof() and casts. 08/06/04 Bob Russell - clean up code for thread startup and exit 08/05/04 Bob Russell - put an ifdef around every call to reparent_to_init() so it is compiled in only for older kernels. 08/04/04 Bob Russell - fixed bug in definition of use_sendpage() in iscsi_initiator.h that crashed 2.6 kernels. - in target, cleaned up thread startup and shutdown to make it more uniform. - added code in scsi_target.h so it now compiles in GENERICIO mode (kernel signal handling changed between 2.4.18 and 2.4.20). GENERICIO mode has not actually been run in a long time! - changed the sense of all tests on TRUST_CDB to better reflect how it is used. - cleaned up Reject processing in initiator and target, and in target, added enqueue_reject() and dequeue_reject() in order to eliminate calls to iscsi_tx_rjt() by rx thread. - a number of small clean ups to change unsigned types to __u types. - added thread id to all Warning and ERROR messages in target. 07/30/04 Bob Russell - numerous small changes to initiator and target to improve error recovery. - cleaned up handle_snack() in target/iscsi_target.c so that retransmissions in response to a SNACK are done by the tx thread only, not by the rx thread. - cleaned up iscsi_retran_thread() in target/target_error_rec.c so timed-out R2T pdus are retransmitted by the tx thread in iscsi_tx_r2t(), using the same mechanism as is used to reply to an R2T_SNACK. Eliminated the function retran_r2t() in the process. - added code to handle_snack() in target/iscsi_target.c to set the A bit on DataIn PDUs at the end of a sequence, under control of the iscsi_manage snack a=y option. - modified cmd/iscsi_manage and target/iscsi_target.c to accept snack a=y option to force target to set A bit on last DataIn PDU in a sequence. - moved several defines relating to SNACKs into common/iscsi_common.h from initiator/initiator_error_rec.h and target/target_error_rec.h - fixed bug in initiator/initiatr_rx.c so that A bit is handled correctly when S bit is also set. - in Makefile-26, added comments and a line to define the FC2 symbol when compiling for RedHat's Fedore Core 2 kernel. RedHat has added an extra (5th) parameter to the kernel function sock_create() and this takes care of that. - in common/iscsi_common.h, changed definition of struct scsi_sense_data to match format in ANSI Project T10/1236-D SCSI Primary Commands -2 (SPC-2), section 7.20.2 Table 102, and fixed use of this structure in initiator_rx.c. 07/29/04 John Donnelly - Applied ntiolia@sourceforge.net fix to scsi_target.c to allow MEMORYIO to work where we were getting target_data.thread_id == NULL error message. 07/20/04 John Donnelly When configuring CHAP on the target, the cl parameter MUST be set. I updated the man page for iscsi_manage.8 to reflect that. 07/19/04 Bob Russell - in target/{scsi_target.c, iscsi_target.c, target_error_rec.c}, and in initiator/{initiator_rx.c, initiator_tx.c, initiator_error_rec.c}, added calls to reparent_to_init() right after every call to daemonize() in order to clean up dead threads correctly so they don't become zombies -- patch contributed by Arne Redlich. - in target/scsi_target.c, function rx_cmd(), in FILEIO mode, when the LUN in a newly received command is bad, don't kill the command but let it fall thru so that handle_cmd() deals with it more gracefully -- patch contributed by Arne Redlich. - in common/target_negotiate.c, fix bug in target's handling of bad version received in a login request. - in Configure, add missing ! to first line: #!/bin/sh - in common/text_param.c, check_for_support(), fix bug in scanning lists of values. - in common/target_negotiate.c, target_check_login(), check validity of NSG only when T bit is set. ................................................... 06/18/04 The changes between UNH iSCSI 1.5.04 and 1.5.03 are: ................................................... 06/18/04 John Donnelly - Updated docs/OVERVIEW to reference "insmod unh_*.o " module names . - Compilers earlier than gcc 2.96 (RH 7.3) seem to fail with recent changes to target/scsi_target.c . I'd suggest updating to a Linux system (RH 8.0 is our development platform now ) with gcc , 3.2 or anything that doesn't use 2.96. - Thanks to all the recent patches by our friends ! Live long and free !. 06/11/04 Bob Russell - in target/scsi_target.c, removed #ifdef DEBUG_HANDLE_CMD around "unknown command" error messages in order to always provide this info. 06/10/04 Bob Russell - in target/scsi_target.c, added EXPORT_SYMBOL(target_in_use) for 2.6 kernel. 05/27/04 Bob Russell - updated target/README to explain how to add/delete files, and how to associate target numbers and lun numbers between initiator and target. - lots of changes to target/scsi_target.{c,h}: - reorganized mapping of target_id and lun numbers to use a new table called target_map_table[][] containing MAX_TARGETS * MAX_LUNS elements, each element is of type target_map_item. Also added a mutex semaphore called target_map_sem to control access to this table. This new table replaces the old scsi_device[][] and target_info[][] tables, the old fdlist, and the old devset_t type. - eliminated global target_num and replaced it with static target_count in scsi_target.c, since the number of targets no longer has to be one more than the largest target_id. - added global target_in_use() to iscsi_common.h, with definitions in initiator/iscsi_initiator.c and target/scsi_target.c. - added addfile and delfile commands (and add_file(), del_file() functions) to FILEIO mode so that files can be dynamically added to or removed from target_map table. These are based on changes provided by Bjorn Thordarson -- thanks Bjorn. - in several places, added info to messages that indicates operating mode (MEMORYIO, DISKIO, FILEIO, GENERICIO) of the scsi_target module. - added cmd_queue_lock spinlock to target_data structure to replace queue_sem as the control lock for the cmd_queue, which is now a generic list_head list. - added allocate_report_lun_space() to consolidate code dealing with REPORT_LUNS commands in the different modes. Much more consolidation of common code needs to be done! - moved dump_buffer() from initiator/initiator_utilities.c to common/lun_packing.c so target could use it too. 04/25/04 Bob Russell - fixed printing of function and line in TRACE printing. - added some minor debug printing in iscsi_target.c 04/08/04 Bob Russell - eliminated a race condition in target in which R2Ts were being sent with ExpCmdSN set to the CmdSN of the command that generated them (should be CmdSN + 1). 04/04/04 Bob Russell - in text_param.c, fixed bug in parsing of, and reporting errors about, the target number at the end of the TargetName string. - in common and initiator subdirectories, cleaned up code by adding TRACE_WARNING and calls to it. Also slightly changed wording in some ERROR messages. - in common subdirectory, cleaned up code by adding print_bad_security_key() and print_not_allowed_security_key() and calls to them. - in scsi_target.{c,h}, fixed race condition on access to command queue. Replaced coded-out cmd_queue_start and cmd_queue_end list with generic "struct list_head cmd_queue", eliminated queue_sem semaphore, replaced add_delete spinlock with cmd_queue_lock spinlock, and used cmd_queue_lock to control all access to the cmd_queue. Also eliminated some unnecessary searches on the cmd_queue. - in scsi_target.c, added a test before all up() on target_data.target_sem so that the up() is done only if the semaphore is not already unlocked (to preserve the semantics of a binary rather than a counting semaphore). 03/19/04 Bob Russell - in target/iscsi_target.c, added code so that in the response to a SendTargets request, references to INADDR_ANY and IN6ADDR_ANY in the iscsi_portal_groups[] table are expanded to send one TargetAddress=xxx for each xxx that is a non-loopback ip_address on the target's host machine. ............................................ The changes between RPM 1.05.03 and 1.05.02 are as follows : 03/16/04 John Donnelly - Added a Configure script to select the appropriate Makefile for either a 2.4 or 2.6 build depending on the current executing kernel. - Updated the README. - Added a "tarball target" to the Makefile files. I'm not planning on creating RPM's anymore for SourceForge, just a tarball that the user can then create their own install RPM as detailed in the README file. 03/15/04 Bob Russell - in top-level Rules.make and Makefile-26, broke out all flags for conditional compilation into separate lines, and added comments explaining each and when to use each. - in iscsi_common.h, added symbol to define IANA's iscsi system port number 860. - in common/my_memory.{c,h}, added #ifdef ISCSI_CHECK_MEMORY around code that can be compiled out. - in common/target_negotiate.c, added code to print login command when TRACE_ISCSI_FULL is defined. - in common/text_param.{c,h}, moved position of print_int_param() and print_boolean_param(), and added print_string_param() (so these could be used by print_config_info()), and added new 2nd parameter to print_session_params() so it could print InitiatorName, TargetName and TargetPortalGroupTag values. - in initiator/Makefile, removed -DISCSI_STATS from CFLAGS = because it has been moved up to top-level makefile in order to put all these conditional compilation flags in one place. - in initiator_rx.c, added many #ifdef ISCSI_CHECK_PDU_FORMAT so detailed checking of received pdu formats (things like reserved fields being set to 0) can be compiled out. Also had to slightly rearrange some code to accommodate this "compiling out" better. - in initiator_utilities.c, added #if defined(CONFIG_ISCSI_DEBUG) around some code that can be compiled out. - in initiator_proc_iface.c, added code to print lun assignments when LUN-assigned-to-connection scheduling is in effect. Also added sess->session_params as new 2nd parameter in calls to print_session_params(). - in iscsi_initiator.c, modified placement of #ifdef ISCSI_STATS in function init_connection() so conn->local_ip_address is always set up. - in scsi_target.c, function get_inquiry_response(), check that buffer is big enough to hold all the inquiry data, and pad short ASCII fields with blanks, not 0x00, as required by SPC-2. Also put file-mode or in-memory into product id field as appropriate to compiled mode of target. - in iscsi_target.c, add if defined(CONFIG_ISCSI_DEBUG) in function iscsi_tx_thread() around declaration of save_mask, and add session->session_params as new 2nd parameter in call to print_session_params() - in security/misc/Makefile, added a missing dependency on common/my_memory.h. 03/09/04 Bob Russell - in target and initiator, move each call to siginitsetinv() so it follows the accompanying call to daemonize(). According to Charles Stoneham at HP, this is necessary on the Linux 2.6.1 kernel. On the 2.4.x kernels it doesn't seem to matter one way or the other. - in initiator, add define MAX_COMMANDS_PER_LUN (currently 8) and modify code to dynamically allocate/free this many command structs whenever a new lun is brought up/down. 03/08/04 Bob Russell - in initiator, revised r2t cookies to fix 2 bugs in ordering r2ts within a connection, to use kernel's generic lists, and generally to clean up the code dealing with r2t cookies. - in initiator, added to /proc interface printing of values set at module load time in struct Scsi_HOST global_host by Scsi_Host_Template and by iscsi_initiator_detect(). Also added printing of some of the "force" values set during initiator configuration. 03/03/04 Bob Russell - in initiator, annotated most "if" conditions with "likely" or "unlikely", as appropriate. This is supposed to improve optimization on later gcc compilers, and if nothing else, documents the expected control path. Also made a few minor cleanups in the process. - in initiator and target, changed del_timer() to del_timer_sync(). 03/01/04 Bob Russell - in initiator, improved printing of info on receiving a reject pdu, sending a SNACK pdu, and detecting a Data CRC error. - in iscsi_target, generalized saving of received pdu header in case of later reject, and changed erroneous references from DataIn to DataOut in printing in handle_data(). 02/27/04 Bob Russell - in initiator, changed from 1 tx thread per session, to 1 tx thread per connection, so now each rx thread is paired with a corresponding tx thread on the same connection. Moved appropriate fields from struct session to struct connection. In the process, made tx_timer be part of struct connection (and connrec_timer part of struct session) rather than separately allocated structures. 02/24/04 Bob Russell - reformat and update docs/iscsi_manage.8 - fix bug in CHAP negotiation in common/target_negotiate.c 02/23/04 Bob Russell - in initiator, changed list for sessions in global host data to use kernel's generic "struct list_head", and added function find_session_by_id() to help clean up code. - added locks around access to global host data in iscsi_initiator_proc_info() and read_proc_file(). - added defines for USE_CONTROL_FILE and USE_PRINT_DATA in initiator_proc_iface.h in order to eliminate compile-time warnings. - updated docs/INI-XREF and docs/INI-CALL_FLOW 02/20/04 Bob Russell - in initiator, changed lists for pending and free commands to use kernel's generic "struct list_head". 02/20/04 John Donnelly - Reset CFLAGS back to -O2, which is the default for kernel modules. Using -O3 with gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) causes compiler core dumps while building the target. - Renamed TIMEOUT_ERROR to ISCSI_TIMEOUT_ERROR because the former conflicts with a new constant in 2.6.2 kernel. 02/16/04 Bob Russell - major modifications to the way initiator does locking/unlocking. - added more debugging to UNH_LOCK, UNH_UNLOCK macros. - added lots of comments about locking and control flow. - changed where the interrupt flags are saved on LOCK so one thread does not clobber the storage of another thread when both spin. - stopped unblocking interrupts when unlocking midlevel's io_request_lock. - in iscsi_target.{c,h} and target_error_rec.c added code so target can send nop pings to initiator and so target now uses kernel's generic "struct list_head" for most lists. - in target_negotiate.h, added fields in structs so target can send nop pings to initiator, and to use kernel's generic "struct list_head" for all lists. - in initiator_tx.c, added TRACE_TIMERS printout. - in iscsi_initiator.{c,h}, added MAX_CDB_LEN and passed it to scsi midlevel. - in initiator_utilities.c, fixed bug on freeing iov_copy. 2-9-2004 John Donnelly - Implement zero Copy feature for 2.6 from Tomonori Fujita ( tomof at users.sourceforge.net ) that replaces sendmsg with sendpage(). On a 2 GHz Xeon workstation system, the enhancement reduces the CPU utilization from 39.4% to 30.8% when writing sequentially with an I/O size of 64KB. ............................................................ The changes between RPM 1.05.02 and 1.05.01 are as follows : Changes from 1.5.02 and 1.5.01 include defects found during the Jan., 12Th 2004 iSCSI IOL PlugFest. 02/02/04 John Donnelly - In initiator/iscsi_initiator.c, iscsi_initiator_queuecommand(), for K26, hold the session lock flags in a local variable instead of current_session->lock_flags. This keeps from corrupting the lock_flags in the transit tread that results in interrupts being turned off and an ASSERT warning " Badness in local_bh_enable at kernel/softirq.c: 121". This occurs while running on a Compaq 2-way SMP machine. While this isn't an ideal fix, but I can't find anyway to fix it at the moment. I still think there is some underlying lock problem in the way the mid-level, transmit, and receive threads interact with each other. - Added cmd/ini-local-26 script. - Chmod +x cmd/ini-install-26 . - Minor mods to Makefile files to be used in a cross-platform build environment(Ming). CHANGES -------- 01/25/04 Bob Russell - changed pack_lun() from a function to a macro, changed it so it expects the result space to have already been cleared (which it always was), changed the calls to it so they do not call it when the lun is zero (since in that case, nothing further needs to be done), and moved it from common/lun_packing.c to common/lun_packing.h. - changed TRACE_BUF debugging in recv_iovector() in initiator_utilities.c so that it will not only print the iovector before doing a sock_recvmsg(), but it will dump the data received by a successful sock_recvmsg(). - in drive_text_negotiate() in initiator_tx.c, fixed bug in amount of memory allocated for text data buffer. - in iscsi_release_session() and iscsi_dequeue() in target/iscsi_target.c, added calls to free ping_data data_buf to fix a memory leak. 01/21/04 Bob Russell - in initiator_rx.c and initiator_error_rec.c, cleaned up some comments and code to better deal with error recovery. - in initiator_utilities.c, cleaned up some comments, made minor changes to recv_iovector() to streamline the code. - in recv_data_in_data() in file initiator_utilities.c, added local buffer for reading small abounts of overflow data (including padding) to avoid extra kmallocs, added code to handle no-memory error, and made changes to streamline the code. - in iscsi_target.c, major changes to the way structures are built and torn down, and to error handling. - in iscsi_target.h, moved r2t_timer from connection to session struct, and nop_period from session to connection struct. - in target_negotiate.c, fixed but in handling of negotiation parameters for 2nd, 3rd, ... connection in an existing session. - in target_error_rec.c, changes for error recovery. - in scsi_target.c, minor changes to printing. 01/21/04 John Donnelly - chmod +x the cmd/*26 scripts . 01/18/04 John Donnelly - In initiator/iscsi_initiator.h, fixed a bug in UNH_LOCK() when UNH_LOCK_DEBUG is defined. - Fixed (typo ?) in add_session_to_hostdata() to do a UNH_LOCK() instead of UNH_UNLOCK() on the session lock. This was a causing an ASSERTION in the 2.6.1 SMP kernel in TCP/IP and was completely ignored in 2.4.20. - Fixed a bug in iscsi_disconnect where on a 2.6.1 system, the parsing of determining the host number to be used for "iscsi_config down host=X" would result in X being evaluated to Zero and we would disable the host HBA if it was a new HBA HotPlug driver. Actually, the bug has been there for sometime since the iSCSI STATS were added, it wasn't noticed until 2.6.1. 01/15/04 Bob Russell - in target, fix bugs in handling of abort and some error recovery cases. - in debug.h, change definition of TRACE_ERROR macro so it is always defined. 01/14/04 Bob Russell - in /target/scsi_target.c, change target's response to a scsi INQUIRY when running in file or memory modes, so that ANSI version is 2 and so the BQue bit is set (which says the target can accept send multiple commands from the initiator). - in initiator_utilities.c and initiator_tx.c, fixed bug in computation of header digest on scsi write commands. This bug was introduced when call to build_write_command() was delayed so that the tx thread could do it. - set configuration in cmd/target-install so initiator can select settings for HeaderDigest, DataDigest, MaxOutstandingR2T, InitialR2T, DataPDUInOrder, and DataSequenceInOrder. (If target keeps these at the defaults, then initiator is forced to use the defaults, even if it offers something else, because of the negotiation rules.) 01/13/04 Bob Russell - update documentation of force options in docs/ISCSI_MANAGE, and align parsing of these options in cmd/scsi_manage.c, initiator/initiator_proc_iface.c, and target/iscsi_target.c. - clean up negotiation of Boolean parameters in common/text_param.c - in login negotiations, add a force option "xok" so that when an X- or X# key is received, instead of sending back a value of NotUnderstood, the value sent back is the same as the value received. This option is enabled via: scsi_manage init force xok or scsi_manage target force xok 01/12/04 Bob Russell - in initiator, fix bug when target CmdSN window goes to 0 - in initiator and target, remove compile-time warnings when CONFIG_ISCSI_DEBUG is not defined. ............................................................................ The changes between RPM's 1.05.01 and 1.04.01 are : 01/10/04 John Donnelly - Added Makefile-24 - Added src/README file that explains the Makefile-24 and Makefile-26. - Corrected cmd/iscsi_init, cmd/iscsi_rebuild and unh_iscsi.specfile to work on either 2.4.x or 2.6.0 platforms. CHANGES -------- 01/09/04 Bob Russell - in initiator, implemented the optional scheduling scheme whereby a lun is assigned to a connection (i.e., all PDUs for a particular lun are carried on one specific connection assigned to that lun). (Internally this is CONN_SCHED_LUN. It is set by externally using ./iscsi_manage init force sch=2 host=0) Note that the connections must be brought up before the new luns are brought up, because the lun assignment is done amoung the connections that exist at the time a new lun is brought up -- luns are not reassigned when a new connection is added, only when an old connection is dropped. This required a new lun_assignments table in the struct session, a new assigned_lun_count field in the struct connection, several new routines in iscsi_initiator.c to add/drop lun assignments (with new calls to them) and changes to the existing routines get_connection(), create_rec_conn(), drop_conn_from_session() and the calls to them. - in initiator, changed handling of logout response pdus from target so that rx thread is shut down only when target's response agrees. - in target, fixed a bug in recovering from data digest errors that occur on immediate data attached to a SCSI Write PDU. This required a new cmnd_list_blocked field in the struct iscsi_session, and changes to read_single_data_seg(), check_cmd_sn(), check_queued_cmnd(), handle_cmnd(), targ_do_error_recovery() targ_digest_recovery() and calls to them. Manny Ortiz - in target, changed all calls to kmalloc/kfree to my_kmalloc/my_kfree CHANGES -------- 01/08/04 John Donnelly - Corrected a rmmod(1) panic when the Initiator driver was removed from the system. The HotPlug function scsi_remove_host() was actually being invoked twice, once from iscsi_initiator_release(), and later in unh_iscsi_remove() . I removed the 1st attempt. - cmd/ini-local (used to run initiator and target on the same machine) can cause data corruption because of mismatched parameters. I removed the target settings of MaxOutstandingR2T=1, InitialR2T=No, DataPDUInOrder=No ,DataSequenceInOrder=No . CHANGES -------- 01/07/04 John Donnelly - Moved siginitsetinv() in initiator_rx.c and initiator_tx.c to be after thread creation since in K26, the task->blocking is not inherited from the parent , thus threads couldn't be killed on shutdown. - Cleaned up HotPlug code functions in iscsi_initiator.c so it compiles without warnings and removed old debug code from iscsi_utilities.c. CHANGES -------- 01/06/04 John Donnelly - Added the 2.6.0 Hot-plug model to the iSCSI Initiator. (files: initiator/iscsi_initiator.c and initiator/iscsi_initiator.h ) - Deleted version.h from repository. It gets created when the driver is built. CHANGES -------- 12/22/03 Bob Russell - in initiator_proc_iface.c, change format for statistics numbers from %d to %u. CHANGES -------- 12/19/03 John Donnelly - Corrected various assumptions about the use of kmap() in initiator/initiator_utilities.c . The initiator now appears to be operational when built with a Test11 K26 kernel with a 2.4 target on a remote machine. CHANGES -------- 12/15/03 John Donnelly - Accepted Ming Zhang (mingz ATT ele DOTT uri DOTT edu ) Target changes for the Linux 2.6 kernel that replaces the use of page_address() with kmap() . This allows the driver to operate when Hi-memory option is used. Files: target/iscsi_target.c target/scsi_target.c, Makefile.K26 . Limited testing. CHANGES -------- 12/12/03 Bob Russell - in initiator, changed definition of UPDATE_ macros in iscsi_initiator.h and calls to them in initiator_rx.c and initiator_tx.c to fix bug where number of bytes being sent was not updated correctly. - in initiator_proc_iface.c, changed the labels in some of the displayed text. 12/11/03 John Donnelly - Moved build_write_command() from the scsi_to_iscsi() interrupt thread to xmit_thread to avoid possible sleep contention while handling an interrupt. This is really intended for upcoming Linux 2.6 kernel work. - Added TRACE_VERBOSE that includes FUNCTION and LINE numbers to tracing. - Replaced all references of page_address() to use kmap() in the K26 build for the initiator. The target will need to be changed too (for K26 builds). page_address() is only intended for low-memory drivers, and will fail on kernels built with high-mem settings. - Added a corresponding kunmap() call in free_pending_command() . - Scatter-Gather for K26 build is broken. It's limited to 1 now until I can get some other critical features working again. CHANGES -------- 12/05/03 Bob Russell - in target/iscsi_target.c, modified save_unsolicited_data() to break large blocks of data into smaller blocks of at most MAX_KMALLOC_SIZE (newly defined in common/my_memory.h) bytes so that the call to kmalloc() will not fail. In that same function, also changed bookkeeping for unsolicited data list to keep pointers to first and last element for faster appending. - in target/iscsi_target.c, modified out_of_order_cmnd() so any immediate data attached to a WRITE scsi command pdu is read in before queueing the command (done to avoid a possible race condition, but is also more efficient). - added "op_buf" parameter to printable_scsi_op() in common/iscsi_common.c, and to all calls to it in the initiator, in order to make it reentrant. 11/23/03 Bob Russell - in iscsi_target.c, added do_task_mgt() and modified handle_task_mgt() to deal correctly with out-of-order and immediate tm request pdus. - in initiator, added i_bit parameter to drive_text_negotiate(), and filled in tests 0 and 1 to send SendTarget text requests as ordinary and immediate commands. - in iscsi_target.c, added deliver_queue_other() and do_discovery_buffer() and modified handle_discovery() to deal correctly with out-of-order and immediate text request pdus. - moved defines for ISCSI_xxx state values from common/iscsi_common.h into target/iscsi_target.h, because they are used only in the target module. Also added the ISCSI_QUEUE_OTHER state and modified handling of NopIn pdus to deal correctly with out-of-order and immediate NopIn pdus. - added function print_session_params() to common/text_param.c which prints only the session-wide key-value pairs in tabular format. Then changed existing calls of print_config_info() into calls to the new function, and added a call to print_config_info() in target/iscsi_target.c and initiator/initiator_proc_iface.c when there are no sessions connected, since this function prints the complete table of current parameter configurations which will be used in the next login negotiation. - changed initiator's attach_pending() so it always sets time_stamp field in the command being attached, and thereby eliminated all settings of this field prior to calls to attach_pending(). - rearranged order of fields in initiator's struct command so that only the fields preceding "next" are zeroed out when command is first set up. - eliminated some race conditions in iscsi_target.c in dealing with out-of-order commands. - added 2.6 modifications contributed by Ming Zhang (Note: John Donnelly did the Initiator port to 2.6.0-test5 based on RPM 1.3.19b, Ming did the Target port). These are conditionally compiled in under control of the K26 symbol. There is a new make file in the src directory, called Makefile-26, 2 new install files in the src/cmd directory, called ini-install-26 and target-install-26, and a new README.K26 in the src/docs directory. 11/14/03 Bob Russell - file initiator/iscsi_initiator.c: changed can_queue value to 2 (from 1) in ISCSI_INITIATOR for midlevel Scsi_Host_Template -- this allows midlevel to have 2 scsi commands active at same time. - file initiator/iscsi_initiator.c: fixed resetting of rr_conn_head and tx_conn_head when a connection is being removed; added do_round_robin() to clean up the code; added parameters to dump_command_info() to dump more info; added add_conn_to_sess() to clean up the code; renamed current_session to sess in drop_conn_from_session() to improve readability and fixed resetting of rr_conn_head and tx_conn_head in this function; renamed current_session to sess in remove_session_from_hostdata(). - file initiator/iscsi_initiator.h: added prototype for remove_luns() to make it global; changed definition of UNH_LOCK and UNH_UNLOCK slightly. - file initiator/initiator_tx.c: eliminated call to clear_free_conn() from iscsi_initiator_tx_thread() because it causes seg faults when a new connection is being added to an existing session that is sending pdus on another connection. We need to go back and re-examine the use of/need for the function clear_free_conn() in error recovery! - file initiator/initiator_tx.c: replaced coded-out loop in tx_shutdown_thread() with call to remove_luns(); in iscsi_initiator_tx_thread(), changed names of local variables from current_session, current_connection and current_command to sess, conn and command respectively -- this made the code a lot more readable in many places; in the same routine, changed check for a connection with a NULL rx_thread to never try to use it. - file initiator/initiator_error_rec.c: replaced coded-out loop in init_recovery_thread() with call to remove_luns(); added lock/unlock around call to scsi_to_iscsi(). - file initiator/initiator_proc_iface.c: commented out call to print_config_info() for each session when printing all sessions; added save/restore of trace mask around call to create_session(). - file target/iscsi_target.c: eliminated references to session->address and replaced them with references to conn->ip_address. - file common/target_negotiate.h: eliminated "struct sockaddr_in *address field from struct iscsi_session, since a session may have many ip addresses connected to it. - file common/text_param.c: moved printing of table header for session parameters into print_config_info(). 11/06/03 Bob Russell - file initiator/initiator_tx.c: fixed bug that caused a seg-fault when a 2nd connection was brought up while first connection was sending data. - file target/iscsi_target.c: fixed update of session->cmnd_id (which generates the target_xfer_tag field in responses), to avoid -1 (which is reserved), and to do the update within the scope of the session->cmnd_sem mutex. - file target/iscsi_target.c: fixed updates of session->max_cmd_sn to do the updating within the scope of the session->cmnd_sem mutex. - file target/iscsi_target.h: removed data_dir field in struct iscsi_cmnd, and references to it in iscsi_target.c (never really used). - file target/iscsi_target.h: added opcode_byte field in struct iscsi_cmnd, and references to it in iscsi_target.c (to test command's I bit in order to know when max_cmd_sn should advance on sending a response). - file target/iscsi_target.h: many code cleanups, mostly adding conn and session parameters to many routines to make their internal coding simpler. - file common/text_param.c: changed print_config_info() to print title, then removed the title printing from callers in initiator_proc_iface.c and target/iscsi_target.c. 11/04/03 Bob Russell - to avoid deadlock, fixed the initiator so locks are always obtained in the order: 1. host_data_lock (our internal host-wide lock) 2. session->sess_lock (our internal session-wide lock) 3. io_request_lock (the scsi midlevel's single-threading lock) To accomplish this, had to release the io_request_lock in those functions called directly from the scsi midlevel, like iscsi_initiator_queuecommand() and iscsi_initiator_abort(). - file initiator_utilities.h: added inline function call_back_scsi_done() to wrap lock/unlock of midlevel's io_request_lock around the call back to the midlevel's scsi_done() function. - file initiator_utilities.c, function free_pending_command(): changed code to call call_back_scsi_done(). - file iscsi_initiator.c, function scsi_to_iscsi(): changed code to call call_back_scsi_done(). - file iscsi_initiator.c, function iscsi_initiator_queuecommand(): release io_request_lock before obtaining our locks so that order of locking is preserved (and therefore deadlock is avoided). - file initiator_error_rec.c, function init_recovery_thread(): add code to lock and unlock session->sess_lock around call to scsi_to_iscsi(). - file iscsi_initiator.c, function iscsi_initiator_abort(): change default return value from SCSI_ABORT_NOT_RUNNING to FAILED, and released the io_request_lock (which was obtained by the midlevel just before calling this routine) while in this routine to avoid deadlock when we attempt to lock it again in free_pending_command() with the sess_lock held. 10/28/03 Bob Russell - file iscsi_target.c: converted most calls to down() into down_interruptible(), and added error checks on all calls to down_interruptible() - file iscsi_target.c: added 2 functions, send_hdr_plus_1_data() and send_hdr_only(), and calls to them in order to combine duplicated code into common functions and to be sure all steps are taken when needed. - file iscsi_target.c: removed a race condition in generation of R2Ts - files iscsi_target.c and target_negotiate.h: added field need_tx_wakeup to struct iscsi_conn and code to check/set/reset this in order to avoid unnecessary up() calls on conn->tx_sem. - file iscsi_target.c: added function read_list_data_seg() and calls to it, removed handle_immediate_data() as it is largely replaced by read_list_data-seg(). - file iscsi_target.c: added function out_of_order_cmnd() to remove processing of out of order commands from the normal path in handle_cmnd(). - added 2 additional tests to iscsi_test.c and initiator_proc-iface.c. - small modification to initiator_tx.c, drive_logout() to handle more cases - file common/debug.h: small format changes and better defn of default macros - files common/iscsi_common.{c,h}: minor format and style changes - file scsi_target.c: many changes, mostly for style and to consolidate code 10/22/03 Bob Russell - file iscsi_target.c: added 2 functions, get_new_cmnd() and ack_send_cmnds(), and calls to them in order to combine duplicated code into common functions and to be sure all steps are taken when needed. 10/17/03 Bob Russell - file iscsi_target.c: made first of many changes needed to get rid of memory leaks. Introduced read_single_data_seq() and modified handle_discovery(), handle_nopout() and save_unsolicited_data() to call it. This also combines duplicated code into one common function. - replaced debug.c and debug.h with new version, and edited a few calls to some of the macros to conform to new style. 10/16/03 Bob Russell - file iscsi_initiator.c: fixed bug in initiator (local instead of remote ip address was being printed in a disconnect message after an error occurred) - file target_negotiate.h: added fields in target's connection structure to keep track of local and remote ip address structures - file iscsi_target.c: added ip address printing in the target /proc output file - file iscsi_target.c: changed subscripted references to iscsi_portal_groups to use pointer references instead. - file iscsi_target.c: added function bring_up_portal() to incorporate duplicated code, and replaced the duplicated code to calls to this function 10/15/03 Bob Russell - file initiator_negotiate.c: changed TRACE code so message is always printed to /var/log/messages when target sends a login reject (i.e., status not 0) .......................................................................... The changes between RPM's 1.04.01 and 1.3.19b are 10/14/2003 John Donnelly Bob Russell - converted all common/ and initiator/ files to Linux K&R coding style and cleaned up comments when necessary . 10/11/2003 Chaoyang Deng (cdeng AT iol DOT unh DOT edu) - fixed 2 race conditions in the generation of R2Ts, in file target/iscsi_target.c. 10/9/2003 Bob Russell (rdr AT iol DOT unh DOT edu) - removed global available_cookies and added it to session structure so adding/removing from that list would be on a per-session basis and thus would be protected by the session lock. a) removed print_r2t_cookies() and calls to it b) removed setup_r2t_cookies() and calls to it c) removed endup_r2t_cookies() and calls to it d) added unbuild_session_skeleton() and call to it - revised handling of r2t_cookies to give better control over error handling. a) revised create_r2t_cookie() and calls to it b) added hookup_r2t_cookie() and calls to it c) added uncreate_r2t_cookie() and calls to it - revised error checking on R2Ts so that: a) an R2T that asks for a previously requested offset is always treated as a recovery R2T b) an R2T that jumps ahead in its requested offset causes an error and is then ignored c) an R2T that would go completely beyond the end of the SCSI buffer causes an error and is then ignored. - cleaned up some of the coding style in initiator_rx.c and initiator_tx.c 10/3/2003 Amarnath Jolad (amarnath DOT jolad AT hp DOT com) - Handled error condition for /proc files. - Handled error condition in add/remove connection. DATE 09/21/2003 Amarnath Jolad (amarnath DOT jolad AT hp DOT com) - Bug 1: When there are multiple connections in a session and when one of the connection is brought down (under some load) the initaitor panics. Fixed by using session lock in remove_session_from_hostdata() while modifying connection list on a session (str). It was holding the global_hostdata lock (lock_host_data) and assuming complete access. Where as it provides access to only the global_hostdata str and not session. - Bug 2: Adding a new connection under load causes initiator to panic. Add multiple connections, bring down one of the connections, load the driver, then add the connection (may be same cid). This causes the initiator to panic. Fixed in add_session_to_hostdata(). The description similar to previous fix. DATE 09/12/2003 Amarnath Jolad (amarnath DOT jolad AT hp DOT com) - Added statistic required for SNMP (partial). - The code change in under #ifdef ISCSI_STAT, this shall be removed in subsequent changes. This has been done to allow ease of review and determining any defects due to these changes. - The modified files are src/initiator/iscsi_intiator.c, initiator_proc_iface.c initiator_rx.c, initiator_tx.c, initiator_utilities.c. - The statistics may not be as accurate as we desire. The current code change creates a placeholder for most of the statistics. Subsequent code changes for this shall increase the accuracy of the stat counters. DATE 08/27/2003 Bob Russell (rdr AT iol DOT unh DOT edu) - fixed bug in print_lun() in common/iscsi_common.c. - added code to target/iscsi_target.c to force the value of the TargetPortalGroupTag key to be the same as that of the session. Chaoyang Deng (cdeng AT iol DOT unh DOT edu) - added files target/iscsi_portal_group.c and target/iscsi_portal_group.h, and modified files target/iscsi_target.c, target/iscsi_target.h, target/Makefile, and common/target_negotiate.h to allow user to give multiple IP/port addresses in different portal groups for the target to listen on. DATE 08/25/2003 Bob Russell (rdr AT iol DOT unh DOT edu) - commented out some debug code in target/scsi_target.c - in common/text_param.c, cleaned up code and added function update_key_value() and calls to it. DATE 08/22/2003 Bob Russell (rdr AT iol DOT unh DOT edu) - rewrote initiator's receive data functions so they now use one iovector for a complete scatter-gather list instead of a separate one-item iovector for each item in the scatter_gather list. Eliminated the function receive_locally() and replaced it by receive_local_data(). Added recv_iovector(), recv_data_in_error(), and recv_data_in_data(). Replaced recv_a_message() with recv_pdu_header, which uses recv_iovector(). Rewrote rx_thread and init_recovery_thread to use recv_local_data() and recv_data_in_data(). Changed struct connection so rx_iov is now an array of MAX_IOV_SLOTS elements, and added a similarily sized array rx_iov_copy to use when computing data digests. Files effected are: iscsi_initiator.h, initiator_utilities.h, initiator_utilities.c, initiator_rx.c and initiator_error_rec.c. - added the no_instrument_function attribute to more function definitions in initiator so that our fkt kernel tracing tool will not trace them. - fixed initiator memory leaks in 2 error cases: 1) when rx_thread breaks out of loop with local buffer still allocated; 2) when aborted command still has pending r2t cookies. -------- DATE 08/13/2003 Bob Russell (rdr AT iol DOT unh DOT edu) - changed initiator's handling of abort so no task management command is sent to target if command to be aborted was not yet sent to target, and so that once a command is being aborted, no additional parts of it (i.e., DataOuts) are sent to the target. - added the no_instrument_function attribute to a number of function definitions so that our fkt kernel tracing tool will not trace them. - changed function names rx_data to iscsi_rx_data and tx_data to iscsi_tx_data in target/iscsi_target.c, target/iscsi_target.h and target/target_error_rec.c in order to avoid confusion with similar names in other kernel modules. DATE 08/11/2003 John Donnelly (John Donnelly AT HP DOT com ) - tagged source as RPM-1-3-19b - add force V=xxx to target/iscsi_target.c .......................................................................... The changes between RPM 1.2.0 and 1.3-19b are : CHANGES - ref20-19b -------- DATE 08/06/03 Bob Russell (rdr AT iol DOT unh DOT edu) - fixed bug in which a task management command itself was not being freed if it could not find the command to be aborted on receiving a TM response. - after creating a new socket, force its "allocation" to be GFP_ATOMIC, not the default GFP_KERNEL, in order to avoid tcp deadlock when out of memory. - added a free_command list to struct session, added endup_command() and modified setup_command() to recycle command structures rather than repeatedly allocating and freeing them -- done to alleviate pressure when memory is tight, but this probably also improves performance. - eliminated some obsolete debug printouts in initiator source files. - cleaned up the initiator source files' formating a bit. - cleaned up format of many TRACE messages in iscsi_target.c CHANGES - ref20-19a. -------- DATE 08/07/2003 John Donnelly (John Donnelly AT HP DOT com ) - With iscsi_trace enabled, tx_shutdown_thread() can reference a NULL ptr on exit. - Updated iscsi_manage.8 and iscsi_config.8 . - Modified iscsi_init script to work with UnitedLinux, aka SuSE. - Modified ini-local script to load the appropriate UNH drivers by name. - Modified the iscsi_build and specfile to place both the Initiator and Target drivers in the /opt/unh/iscsi/module directory. - Added -V verbose to iscsi_manage for Initiator debugging. - Removed __GFP_HIGHIO from MY_GFP_KERNEL arg to malloc() because 2.4.7 (RH 7.x distros ) don't define it. CHANGES - ref20-19. -------- DATE 07/30/03 Chaoyang Deng (cdeng AT iol DOT unh DOT edu) - Changes to target/iscsi_target.c to fix bugs in handle_task_mgt_command() where new command struct was not being reset to 0. - Added check in handle_iscsi_done() in target/iscsi_target.c to stop sending DataOut PDUs when command has been aborted. - Changed handle_iscsi_mgt_fn_done() in target/iscsi_target.c to delay clearing the aborted command structure by just setting its state to ISCSI_DEQUEUE. - Changed type of data_length_left in iscsi_tx_r2t() in target/iscsi_target.c from __u32 to int so comparisons with it are signed, not unsigned (fixes bug in R2T sending). - In scsi_target_process_thread() in target/scsi_target.c, stopped changing state of abort command to ST_DEQUEUE. DATE 07/29/03 Bob Russell (rdr AT iol DOT unh DOT edu) - Fixed bug in target_check_login() in common/target_negotiate.c which caused tsih to be returned as 0 on final login response that did a transition from security negotiation phase to full feature phase (i.e., that bypassed operational negotiation phase). - Fixed bug in main loop in target_security_negotiate() in common/target_negotiate.c by changing from "infinite" to a "while" loop that exits when the output pdu just sent has NSG=3. This cures a bug in which the first pdu after the last login response is lost when there is a transition from security negotiation phase to full feature phase (i.e., operational negotiation phase is bypassed). - Fixed bug in handling result of call to drop_conn_from_session() in iscsi_initiator.c -- the caller's conn had to be set to NULL when drop_conn_from_session() returned 1 (removing last connection in session). Also moved drop_conn_from_session() in the file and made it static. - Changed name of "signal_thread" and "target_thread" in target/scsi_target.c to be less than 16 characters long. - Changes position of set_fs(old_fs) in several places to be sure it gets done even if an error exit is taken. - Added print_on_success parameter to find_aborted_command() in initiator/iscsi_initiator.c to avoid duplicate printing. - Added local save_trace to iscsi_initiator_abort() in initiator/iscsi_initiator.c to turn on more debug printing when processing an abort. - Added debug printout to rx_task_mgt_rsp() in initiator/initiator_rx.c to provide more debug printing when processing a task management response. - In iscsi_initiator_rx_thread() in initiator/initiator_rx.c, added check for task management response opcode when the received StatSN is not equal to our ExpStatSN. When this happens, we now update ExpStatSN to avoid a spurious error caused by a successful abort. - Added symbolic constants for LOGOUT "reason" codes to common/iscsi_common.h and used these in drive_logout() in initiator/initiator_tx.c and in calls to drive_logout() in initiator/initiator_error_rec.c and initiator/initiator_rx.c. - Changed where the session lock is unlocked in init_recovery_thread() in initiator/initiator_error_rec.c to fix bug. CHANGES - ref20-18a ------------------- DATE 07/28/03 John Donnelly (John Donnelly AT HP DOT com ) - Removed the IRQ spinlock "my_lock" and all references to it. Replaced it with new "host_data_lock" that secures access to the global data structure "global_hostdata". - Added per-session IRQ spinlocks instead of the prior shared "my_lock". to the Initiator driver. The Initiator has shown a reasonable performance gain when used with multiple sessions. Added the defines UNH_LOCK() and UNH_UNLOCK() as wrappers for spin_lock_irqsave() and spin_unlock_irqrestore(). Removed references to FAST_SPIN_LOCKS. Files affected: ./initiator/iscsi_initiator.c ./initiator/initiator_tx.c ./initiator/iscsi_initiator.h ./initiator/initiator_utilities.c ./initiator/initiator_proc_iface.c ./initiator/initiator_rx.c ./initiator/initiator_error_rec.c Note that the Target driver still uses a single spin lock for all sessions. However, the Target Driver still doesn't work on SMP machines. Users will need to run a non-SMP kernel if they want to simulate a iSCSI Target on a multi-processor box. - Added a IRQ spin lock to the UNH memory allocator/de-allocator wrapper in my_memory.c since sessions are no longer syncronized with "my_lock" - Removed __get_cpu_number() from initiator/iscsi_initiator.c . - Removed the use of "typedef struct" in all security/*/*.h headers and made corresponding code changes in the Initiator driver to support them. - The driver(s) now build with and without CONFIG_ISCSI_DEBUG defined. - Added the "-g" flag to Rules.make so "objdump -l -S" works reasonably well on the drivers and associated object files. - Converted all the C source files to the more acceptable K&R coding style and cleaned up comments when necessary . - Converted the majority of Initiator Driver files (initiator/* , security/* and common/*) to the more acceptable Linux coding style of tabstops=8, rearranging portions of the Initiator where necessary. There are 4 files (common/target_negotiate.c, common/target_negotiate.c, common/text_param.c that are shared with the Target Driver, and initiator/initiator_proc_iface.c ) that will remain with tabstops set to 4 because of their complexity of dealing with text login parameters. These files may be restuctured / rewritten in some future release to accomodate typical tabstop settings. - In initiator/initiator_tx.c, added new functions tx_retransmit_state[1-3]() to condense check_for_retransmit() into a reasonable size function . - In initiator/initiator_rx.c, added rx_pack_cookie_from_pdu() to condense rx_r2t() to a reasonable size function . - In initiator/iscsi_initiator.c, added drop_conn_from_session() to condense remove_session_from_hostdata() to a reasonable size function . - Note that the Target Driver is still formatted with TabStops=4. DATE: 07/21/03 CHANGES ref20-18. ------- Bob Russell - Changed string_llx() function because argument is in network byte order. Chaoyang Deng (cdeng@iol.unh.edu) - Changed target to deal with Task Management Command - Changed target to fix overflow bug on inquiry command (Linux gives a CDB length of 255, but a transfer length of 256) - Changed target to unpack LUN correctly DATE: 07/15/03 CHANGES ------- Bob Russell - Changed kill signal to SIGHUP so initiator could be used for rebooting - Added code to iscsi_initiator.c from Mike Christie at IBM to register the initiator for rebooting. - Created the files common/lun_packing.c and .h, and moved code from the initiator into them so it could also be used by scsi_target.c. Also changed this code so it would be independent of the host's endianness. Chaoyang Deng - Corrected code in scsi_target that deals with REPORT LUNS. - Added code in scsi_target to handle REPORT LUNS, MODE SENSE and VERIFY in memory mode. DATE: 07/11/03 CHANGES ------- Bob Russell - Removed several bugs in error recovery level 1. - Initiator now sends DataACK SNACK in response to a DataIn PDU with the A bit set. - In initiator, added "order_number" to r2t_cookie, and "assign/process-r2t_order" to struct connection so that r2ts will be processed in the order they were received within 1 connection. - In initiator, added "still_to_send" in struct command to synchronize setting of CMD_STATE_TX_DONE bit in "cmd_state" after very last xmit to target. - In initiator, added "tx_sent_so_far", "tx_wait_to_send", tx_iovlen, and "tx_iov_copy" to struct command to allow MSG_DONTWAIT bit to be set on sock_sendmsg(). Also added "short_command" to struct connection to ensure that a partially sent command is completed in order on the connection. - Added my_spinlock functions to test correct locking/unlocking sequences even on a uniprocessor. - In initiator, added dump_command_info for pending/aborted commands; used on an abort. DATE: 06/26/03 CHANGES ------- Bob Russell - Forced use of SNACK when ErrorRecoveryLevel > 0 as required by std. - Postpone sending SNACK on missing DataIn until end of data xfer. - Fixed many bugs in error recovery on both initiator and target. - Added cmd_error_state and state machine for rx error recovery. - Cleaned up the some of the error recovery code. - Eliminated retran_timer in initiator The changes between RPM 1.2.0 and 1.1.0 are : DATE: 06/16/03 RPM 1.2.0 CHANGES ------- John Donnelly - /proc/scsi/iscsi_initiator now reports negotiated parameters for each connection. - Minor cleanup of README file(s) BOB RUSSELL - Changed tx_timer to go off every second to wake up tx_thread. - Changed scanning of connections in tx_thread to pick up where left off. - Changed initialization of session->thr_kill_sem in target to locked. - Fixed mutex unlocking problems in target on error paths. - Fixed memory leaks in target on error paths. - Fixed memory leak in target's rx_data(). - Shortened many error messages in target. - Fixed a bug in initiator tx_thread where Data-Out PDUs would be dropped causing the initiator to hang. - Fixed bugs in target negotiation of CHAP keys. - Added more error checking during negotiation of CHAP and SRP keys, primarily for the limit on the length of received binary values. - Changed a number of global variables to static to avoid "B", "C" and "D" symbol types in the .o loadable module -- these cause problems when both the initiator and target modules are loaded together in the same kernel and both modules define the same symbol. - Further cleanup of authentication code: -- made all the GOT bitmasks common to both initiator and target -- made check_step_key() common to both initiator and target -- added check_step_key_number() -- added hash table for all CHAP and SRP keys and rewrote is_securitykey() -- added check in target for reflected CHAP_C challenges CHONG ZHANG (chongz@iol.unh.edu) - New version of security/math functions for increased speed in SRP DATE: 06/08/03 CHANGES ------- BOB RUSSELL - Fixed initiator bug caused when bringing down multiple connections 1 at a time. - Fixed initiator race caused when a target disconnects from a new session immediately after last login response (the one that makes transition to FFP). - Reorganized Authentication checking during security phase of login to accommodate both CHAP and SRP and make it easier to include other methods in the future. Also fixed some bugs in CHAP files and the target. Added SRP, but it is currently too slow to be viable, so caused it to always fail (quickly). - Added make_full_path_dir() in iscsi_config.c to create all directories in a path to a new directory. - Updated many of the files in cmd subdirectory to fix bugs caused mostly by neglect of these files when other changes were made. DATE: 05/16/03 RPM 1.1-1 CHANGES ------- BOB RUSSELL - Minor typo changes to doc files and initiator Makefile. - Restored some CONFIG_ISCSI_DEBUG debug code that was missed by last merge in initiator_proc_iface.c . - Removed field "param_tbl" from the "struct iscsi_hostdata" which is no longer used. John Donnelly - Added "fuser -k" to iscsi_umount to ensure the file systems are umounted and the UNH driver can then be successfully removed. - Added an RPM.HOWTO readme file. DATE: 05/13/03 KARTHIK CHANDRASEKARAN (RPM : 1.1-0) MAJOR FEATURES -------------- - CONCURRENT ISCSI_MANAGE / ISCSI_CONFIG OPERATIONS The iSCSI Initiator now supports concurrent iscsi_config and iscsi_manage operations. The iscsi_manage command now takes an optional "target=" parameter that sets the desired parameter for that target alone. If target is omitted, a value of 0 is assumed. The iscsi_hostdata structure has been split into two parts, iscsi_hostdata -> the global initiator wide attributes and an array of iscsi_targetdata structures, that house target specific values. Files affected: initiator/initiator_error_rec.c initiator/initiator_error_rec.h initiator/initiator_proc_iface.c initiator/initiator_utilities.c initiator/iscsi_initiator.c initiator/iscsi_initiator.h docs/iscsi_manage.8 docs/ISCSI_MANAGE scripts/target.sample CHANGES ------- - Fixed docs/iscsi_manage.8 (some portions refer to iscsi_config.8) - proc_info() routine now displays the maximum targets configured [initiator/initiator_proc_iface.c] - Increased number of targets to 10 [from 4]. ------------------------------------------------------------------------ DATE: 05/12/03 JOHN DONNELLY MAJOR FEATURES -------------- - RPM version information is now included as part of the driver through version.h. This information is displayed during driver startup. Can also be obtained by reading the iSCSI initiator's /proc file entry. CHANGES ------- - Remove commented line in free_pending_command() - initiator/initiator_utilities.c. - Change SCSI_RET_SUCCESS to SUCCESS in iscsi_initiator_reset() [initiator/iscsi_initiator.c]. ------------------------------------------------------------------------ DATE: 05/12/03 BOB RUSSELL CHANGES ------- - in Rules.make, changed -O2 to -O3 - in common/debug.c, removed "0 |" from initialization of iscsi_trace - in several files in initiator/ -- changed calls to "attach_pending_command" by adding an extra parameter called bypass_tx_up, then incorporating the up(tx_sem) that always followed a call to attach_pending_command into attach_pending_command itself. - in initiator/initiator_tx.c, added check for target window closing - in initiator/initiator_utilities.c, added check for target window reopening - in initiator/Makefile, fixed a minor typo - in target/Makefile, fixed a minor typo - minor changes to cmd/{geometry.c,iscsi_manage.c} - fixed bug in cmd/iscsi_config.c related to tapes - in cmd/Makefile, fixed a minor typo ------------------------------------------------------------------------ DATE: 05/05/03 KARTHIK CHANDRASEKARAN [ RPM - 1.0-3] MAJOR FEATURES -------------- - RULES.MAKE SUPPORT Top level Rules.make introduced. The Makefile-s in all subdirectories now use Rules.make. - DYNAMIC DEBUG TRACE SETTING Introduced dynamic debug level setting. If CONFIG_ISCSI_DEBUG is enabled, the value of iscsi_trace (that determines the level of debug information) defaults zero. This value can be dynamically set by the /proc interface. echo "iscsi_debug " /proc/scsi/iscsi_initiator/ For example, the following command, echo "iscsi_debug 0xc" > /proc/scsi/iscsi_initiator/0 will enable, TRACE_ISCSI and TRACE_NET, while echo "iscsi_debug 0" > /proc/scsi/iscsi_initiator/0 will turn off all DEBUG tracing (TRACE_ENDING), and echo "iscsi_debug 0xffffffff" > /proc/scsi/iscsi_initiator/0 will turn on ALL DEBUG tracing (TRACE_ALL). CHANGES ------- - The iSCSI initiator failed to build with CONFIG_ISCSI_DEBUG disabled. Fixed debug.h. - Fixed iscsi_mount to report failures correctly. - Merged John's SMP fixes to iscsi_initiator.c and initiator_utilities.c. - Fixed fstab.iscsi.sample: moved examples inside comments area. - Remove executable permission for all source files. Changed the group and owner attributes of all files to "root". - Modified startup/shutdown scripts to output error messages correctly using new functions, echo_cmd and cmd_ret that replace exec_cmd functionality. Previously, the success and failure message were displayed after an action was complete (say, connect or mount). This might confuse the user. Now, the action message is displayed (for example, "Connecting to iSCSI Targets"), the action is performed and then the result is displayed (OK or FAILED). - Additional uninstall messages (part of %preun in unh_iscsi.specfile) ------------------------------------------------------------------------ DATE: 05/02/03 BOB RUSSELL CHANGES ------- - in initiator/iscsi_initiator.c added max_sectors field to ISCSI_INITIATOR, the initializor for Scsi_Host_Templage - in target subdirectory numerous bug fixes to target ------------------------------------------------------------------------ DATE: 04/30/03 KARTHIK CHANDRASEKARAN [ RPM - 1.0-2] MAJOR FEATURES -------------- - MAN PAGE SUPPORT Man pages added for iscsi_config(8) and iscsi_manage(8) - SCSI TAPES & CD-ROM DEVICE PERSISTENCE SCSI Tape and CD-ROM devices included for persistent binding (iscsi_config) - UNH iSCSI INITIATOR DEVICE SUPPORT iscsi_device.c added to register /dev/unh_iscsi_initiator and added dummy ioctl. The ioctl function is only a placeholder for now and can be enhanced to provide support for various functions. The major number is allocated dynamically, and the /etc/init.d/unh_iscsi script creates the device based on the assigned major number. - MAKEFILE CLEANUP initiator/Makefile reduced to 52 lines (from 165) CHANGES ------- - Removed TargetAlias reference from target.sample * According to the iSCSI Draft the TargetAlias key is sent only by the Target to the Initiator. * Updated documenation in target.sample. - Updated documenation in README.CONFIG ------------------------------------------------------------------------ DATE: 04/23/2003 KARTHIK CHANDRASEKARAN [ RPM - 1.0-2] MAJOR FEATURES -------------- - Complete packaging support for RedHat and SuSE [ RPM build, cleanup, pre-install, post-install scripting] - Complete startup, conenct, mount, unmount, disconnect, shutdown support [ mount/umount can deal with swap partitions too ] - Persistent device binding [ Accessing devices based on /opt/unh/iscsi/dev/ or /opt/unh/iscsi/dev/ instead of ever-changing /dev/sd* to provide mount-point consistency accross reboots] - Auto-probe for multiple LUNs on target - Dynamic compile and install of UNH iSCSI modules for the kernel booted. This means that the UNH RPM need not be re-installed for every booted kernel. Only the kernel source for the booted kernel need to be present. - Documentation installed in distribution specific area [ /usr/share/doc/unh_iscsi*] ADDED FILES ----------- cmd/iscsi_init - The main iSCSI init file. Installed as /etc/init.d/unh_iscsi cmd/iscsi_connect - Connects to multiple targets. Auto host no and target no allocation to configuration scripts in /opt/unh/iscsi/conf cmd/iscsi_mount - Mount file systems on iSCSI devices. Provides Target name based abstraction. cmd/iscsi_disconnect - Disconnect from iSCSI targets. cmd/iscsi_umount - Unmount file systems/swap on iSCSI Targets. cmd/iscsi_rebuild - Rebuild UNH iSCSI modules dynamically based on the kernel booted. The UNH iSCSI modules are built for the booted kernel and the modules are placed in /opt/unh/iscsi/modules/. MODIFIED FILES -------------- chap/Makefile common/Makefile initiator/Makefile target/Makefile - Modified KERNEL_DIR to be /lib/modules/`uname -r`/build rather than hardcoding the kernel name. common/debug.c - iscsi_trace set to 0 to prevent debugging turned on by default. initiator/initiator_utilities.h initiator/iscsi_initiator.c initiator/iscsi_intiator.h initiator/initiator_rx.c initiator/initiator_tx.c - John's SMP changes merged in. cmd/iscsi_config.c - Fixed bug: If multiple luns are connected on a session, bringing down the session only does "remove-single-device" for a single lun. All other luns are left attached (dangling) in the SCSI mid layer. - FEATURE: Creating device nodes in /opt/unh/iscsi/dev to provide PERSISTENT BINDING. - FEATURE: Omitting lun= parameter in the iscsi_config command line will auto-probe the target for all LUNs.