summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi
AgeCommit message (Collapse)Author
2008-05-02[SCSI] Let scsi_cmnd->cmnd use request->cmd bufferBoaz Harrosh
- struct scsi_cmnd had a 16 bytes command buffer of its own. This is an unnecessary duplication and copy of request's cmd. It is probably left overs from the time that scsi_cmnd could function without a request attached. So clean that up. - Once above is done, few places, apart from scsi-ml, needed adjustments due to changing the data type of scsi_cmnd->cmnd. - Lots of drivers still use MAX_COMMAND_SIZE. So I have left that #define but equate it to BLK_MAX_CDB. The way I see it and is reflected in the patch below is. MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB as per the SCSI standard and is not related to the implementation. BLK_MAX_CDB. - The allocated space at the request level - I have audit all ISA drivers and made sure none use ->cmnd in a DMA Operation. Same audit was done by Andi Kleen. (*)fixed-length here means commands that their size can be determined by their opcode and the CDB does not carry a length specifier, (unlike the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly true and the SCSI standard also defines extended commands and vendor specific commands that can be bigger than 16 bytes. The kernel will support these using the same infrastructure used for VARLEN CDB's. So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml supports without specifying a cmd_len by ULD's Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-27[SCSI] zfcp: Add some statistics provided by the FCP adapter to the sysfsSwen Schillig
The new FCP adapter statistics provide a variety of information about the virtual adapter (subchannel). In order to collect this information the zfcp driver is extended to query this information. The information provided by the new FCP adapter statistics can be fetched by reading from the following files in the sysfs filesystem /sys/class/scsi_host/host<n>/seconds_active /sys/class/scsi_host/host<n>/requests /sys/class/scsi_host/host<n>/megabytes /sys/class/scsi_host/host<n>/utilization These are the statistics on a virtual adapter (subchannel) level. The information provided is raw and not modified or interpreted by any means. No interpretation or modification of the values is done by the zfcp driver. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-27[SCSI] zfcp: Print some messages only during ERPSwen Schillig
When statistics are polled from sysfs, the statistics use the same commands as the adapter initialization. Change the messages printed here, so they are only printed during initialization and not for each poll of adapter data. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-27[SCSI] zfcp: Wait for free SBAL during exchange configSwen Schillig
When sending a exchange config data command, wait for a free SBAL. This does not matter during adapter initialization, but this is required for pulling adapter statistics during high I/O load. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-18Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (137 commits) [SCSI] iscsi: bidi support for iscsi_tcp [SCSI] iscsi: bidi support at the generic libiscsi level [SCSI] iscsi: extended cdb support [SCSI] zfcp: Fix error handling for blocked unit for send FCP command [SCSI] zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlock [SCSI] zfcp: fix 31 bit compile warnings [SCSI] bsg: no need to set BSG_F_BLOCK bit in bsg_complete_all_commands [SCSI] bsg: remove minor in struct bsg_device [SCSI] bsg: use better helper list functions [SCSI] bsg: replace kobject_get with blk_get_queue [SCSI] bsg: takes a ref to struct device in fops->open [SCSI] qla1280: remove version check [SCSI] libsas: fix endianness bug in sas_ata [SCSI] zfcp: fix compiler warning caused by poking inside new semaphore (linux-next) [SCSI] aacraid: Do not describe check_reset parameter with its value [SCSI] aacraid: Fix down_interruptible() to check the return value [SCSI] sun3_scsi_vme: add MODULE_LICENSE [SCSI] st: rename flush_write_buffer() [SCSI] tgt: use KMEM_CACHE macro [SCSI] initio: fix big endian problems for auto request sense ...
2008-04-18[SCSI] zfcp: Fix error handling for blocked unit for send FCP commandChristof Schmitt
In the case the unit is blocked, zfcp_unit_get has not been called yet, so the error handling path should not call zfcp_unit_put. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-18[SCSI] zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlockChristof Schmitt
The testcase # chchp -v 0 0.da && sleep 59 && chchp -v 1 0.da results in this deadlock situation: STACK TRACE FOR TASK: 0x7e9a2048 (zfcperp0.0.c613) 0 schedule+816 [0x356b3c] 1 schedule_timeout+172 [0x357340] 2 wait_for_common+192 [0x3565fc] 3 flush_cpu_workqueue+116 [0x52af0] 4 flush_workqueue+116 [0x533b8] 5 fc_remote_port_add+64 [0x1c83ec] 6 zfcp_erp_thread+4534 [0x26585a] 7 kernel_thread_starter+6 [0x195d2] STACK TRACE FOR TASK: 0x7f8ec048 (fc_wq_0) 0 schedule+816 [0x356b3c] 1 zfcp_erp_wait+104 [0x264568] 2 zfcp_scsi_slave_destroy+64 [0x261b24] 3 __scsi_remove_device+154 [0x1c24ba] 4 scsi_remove_device+62 [0x1c2512] 5 __scsi_remove_target+198 [0x1c25ea] 6 __remove_child+58 [0x1c26d6] 7 device_for_each_child+66 [0x1ab566] 8 scsi_remove_target+98 [0x1c268a] 9 run_workqueue+200 [0x5272c] 10 worker_thread+146 [0x52882] 11 kthread+140 [0x58360] 12 kernel_thread_starter+6 [0x195d2] Remove the zfcp_erp_wait call that is not required here to prevent the deadlock situation. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-18[SCSI] zfcp: fix 31 bit compile warningsMartin Peschke
drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_rscn’: drivers/s390/scsi/zfcp_aux.c:1379: warning: cast from pointer to integer of different size drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_plogi’: drivers/s390/scsi/zfcp_aux.c:1432: warning: cast from pointer to integer of different size drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_logo’: drivers/s390/scsi/zfcp_aux.c:1457: warning: cast from pointer to integer of different size .. Just passing pointers rids us of these warnings and improves readability. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-17[SCSI] zfcp: fix compiler warning caused by poking inside new semaphore ↵Martin Peschke
(linux-next) as seen in linux-next tree: drivers/s390/scsi/zfcp_dbf.c: In function ‘zfcp_rec_dbf_event_thread’: drivers/s390/scsi/zfcp_dbf.c:697: warning: passing argument 1 of ‘atomic_read’ from incompatible pointer type Caused by recent git commit: commit 348447e85749120ad600a5c8e23b6bb7058b931d Author: Martin Peschke <mp3@de.ibm.com> Date: Thu Mar 27 14:22:01 2008 +0100 [SCSI] zfcp: Add trace records for recovery thread and its queues We are not supposed to poke inside semaphore. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Acked-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-17[S390] replace remaining __FUNCTION__ occurrencesHarvey Harrison
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-07[SCSI] zfcp: Add docbook comments to debug trace.Martin Peschke
Add missing docbook-comments for functions forming zfcp's internal trace API. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Cleanup line breaks in debug trace.Martin Peschke
Remove line breaks that do not conform to coding style. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Shorten excessive names in debug trace.Martin Peschke
Saving on line breaks, improving readability, by shortening excessive function names and identifiers, by simplifying some functions call chains, and by simplifying nesting of some data structure. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Move DBF definitions to private header fileChristof Schmitt
Unclutter the global zfcp_def.h header. Move everything required to call into the debug feature to a new header file. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Simplify zfcp_dbf_tag and related functions in debug trace.Martin Peschke
Simplify usage of zfcp_dbf_tag() and calling functions. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Simplify usage of hex dump output function for debug trace.Martin Peschke
Simplify usage of output function for hex dumps. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Remove obsolete output function from debug trace.Martin Peschke
Remove obsolete output function. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Cleanup debug trace view functions.Martin Peschke
Improve readability of code by using more convenient output function. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: simplify zfcp_dbf_timestamp()Martin Peschke
Change zfcp_dbf_timestamp() so that it just calculates timespec from timestamp. First step to be able to rip this code out of zfcp. Besides, this change makes it easier to rip out old-style debug view functions. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Remove obsolete erp_dbf traceMartin Peschke
This patch removes the now obsolete erp_dbf trace. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Add trace records for recovery actions.Martin Peschke
This patch writes trace records for various phases of a recovery action: action being created, action being processed, action continueing asynchronously, action gone, action timed out, action dismissed etc. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Trace all triggers of error recovery activityMartin Peschke
This patch allows any recovery event to be traced back to an exact cause, e.g. a particular request identified by an id (address). Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Add traces for state changes.Martin Peschke
This patch writes a trace record which provides information about state changes for adapters, ports and units, e.g. target failure, targets becoming online, targets being temporarily blocked due to pending recovery, targets which have been recovered successfully etc. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Add trace records for recovery thread and its queuesMartin Peschke
This patch writes trace records which provide information about the operation of the zfcp error recovery thread and the queues it works on. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Register new recovery trace.Martin Peschke
This patch registers the new recovery trace with the s390 debug feature. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Introduce printf helper functions for debug trace.Martin Peschke
Introducing helper functions that allow for code simpfifications. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Add qtcb dump to hba debug traceMartin Peschke
This patch adds per request hardware debugging data to the trace record which is written per request. It's a replacement for some sad kernel message based debugging code. Considering the amount of trace data, printk() is not suitable for this stuff. Writing binary traces is more efficient. In addition we got all information in one place. The QTCB trace data is only dumped for requests other than SCSI requests. Otherwise we would flood the trace ring buffer. We are mostly interested in non-SCSI, recovery related requests here anyway. This patch also works around a known hardware bug. It truncates QTCB traces so that we do not save unused areas of the hardware trace. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Remove qtcb dump to kernel logMartin Peschke
Is not appropriate to printk() tons of hardware trace data. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Clean up _zfcp_san_dbf_event_common_elsMartin Peschke
Clean up _zfcp_san_dbf_event_common_els using zfcp_dbf_hexdump() helper. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Introduce a helper function that dumps hex data to a zfcp trace.Martin Peschke
Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: Fix handling for boxed port after physical closeChristof Schmitt
When a FSF physical close returns the status boxed, this means that another system already closed the port. For our system this is the same status as in the good path, we have to send the normal close. So, set the status for the boxed response to the same as for the good status. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] zfcp: convert zfcp to use target reset and device reset handlerChristof Schmitt
[based on proposal from Mike Christie <michaelc@cs.wisc.edu>, this patch adds some simplifications to the handler functions] With the new target reset handler callback in the SCSI midlayer, the device reset handler in zfcp can be split in two parts. Now, zfcp does not have to track anymore whether the device supports LUN resets, so remove this flag and let the SCSI midlayer decide what to do. The device reset handler simply issues a LUN reset and the target reset handler a target reset. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-30[SCSI] zfcp: fix sense_buffer access bugFUJITA Tomonori
The commit de25deb18016f66dcdede165d07654559bb332bc changed scsi_cmnd.sense_buffer from a static array to a dynamically allocated buffer. We can't access to sense_buffer in '&cmd->sense_buffer' way. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-26[S390] drivers/s390/: Spelling fixesJoe Perches
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] drivers/s390: Add missing "space"Joe Perches
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-25Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits) [SCSI] usbstorage: use last_sector_bug flag universally [SCSI] libsas: abstract STP task status into a function [SCSI] ultrastor: clean up inline asm warnings [SCSI] aic7xxx: fix firmware build [SCSI] aacraid: fib context lock for management ioctls [SCSI] ch: remove forward declarations [SCSI] ch: fix device minor number management bug [SCSI] ch: handle class_device_create failure properly [SCSI] NCR5380: fix section mismatch [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices [SCSI] IB/iSER: add logical unit reset support [SCSI] don't use __GFP_DMA for sense buffers if not required [SCSI] use dynamically allocated sense buffer [SCSI] scsi.h: add macro for enclosure bit of inquiry data [SCSI] sd: add fix for devices with last sector access problems [SCSI] fix pcmcia compile problem [SCSI] aacraid: add Voodoo Lite class of cards. [SCSI] aacraid: add new driver features flags [SCSI] qla2xxx: Update version number to 8.02.00-k7. [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command. ...
2008-01-24zfcp: Use device_driver default attribute groups.Cornelia Huck
CC: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-11[SCSI] zfcp: Hold queue lock when checking port/unit handle for task ↵Christof Schmitt
management cmd We need to hold the queue-lock when checking whether we still have a valid unit/port handle for the task management command, i.e whether we can issue this request for this unit/port. If the error recovery is about to close this unit/port, then it competes for the queue-lock. If the close request issued by the error recovery wins, then it is guaranteed that this unit/port has been blocked for other requests. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Hold queue lock when checking port/unit handle for FCP commandChristof Schmitt
We need to hold the queue-lock when checking whether we still have a valid unit/port handle for the FCP command, i.e whether we can issue this request for this unit/port. If the error recovery is about to close this unit/port, then it competes for the queue-lock. If the close request issued by the error recovery wins, then it is guaranteed that this unit/port has been blocked for other requests. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Hold queue lock when checking port handle for ELS commandChristof Schmitt
We need to hold the queue-lock when checking whether we still have a valid port handle for the ELS command, i.e whether we can issue this request for this port. If the error recovery is about to close this port, then it competes for the queue-lock. If the close request issued by the error recovery wins, then it is guaranteed that this port has been blocked for other requests. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Hold queue lock when checking port/unit handle for abort commandChristof Schmitt
We need to hold the queue-lock when checking whether we still have a valid unit/port handle for the abort command, i.e whether we can issue this request for this unit/port. If the error recovery is about to close this unit/port, then it competes for the queue-lock. If the close request issued by the error recovery wins, then it is guaranteed that this unit/port has been blocked for other requests. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Fix evaluation of port handles in abort handlerChristof Schmitt
According to the FSF spec, word 0 (bytes 0-3) has the handle specified with the abort command and word 1 (bytes 4-7) has the handle for the command to be aborted. Fix the if statements that try to compare those. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: fix use after free bug.Heiko Carstens
zfcp_erp_strategy_check_fsfreq() checks if it is safe to access the fsf_req associated with the erp_action that gets passed. To test if it is safe it accesses the fsf_req in order to get its index into the hash list. This is broken since the fsf_req might be freed already and the read index has no meaning. It could lead to memory corruption. Fix this by introducing a new zfcp_reqlist_find_safe() method which just checks if addresses are equal. This is slower, but only gets called in case of error recovery. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Reduce flood on hba traceChristof Schmitt
Remove tracing for request with a "qualifier" field set in the response. The protocol status qualifier now contains measurement data for "good" commands, so this check would trace every response by default. The fix is to simply remove the "qual" tracing: The responses with an interesting status are also traced as "ferr" or "perr" and all responses can be traced as "norm" with a higher trace level. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Fix deadlock when adding invalid LUNChristof Schmitt
When adding an invalid LUN, there is a deadlock between the add via scsi_scan_target and the slave_destroy handler: The handler waits for the scan to complete, but for an invalid unit, scsi_scan_target directly calls the slave_destroy handler. Fix the deadlock by removing the wait in the slave_destroy handler, it was not necessary anyway. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Remove SCSI devices when removing complete adapterChristof Schmitt
The common I/O layer can call remove a handler to inform zfcp that a device disappeared. The handler zfcp_ccw_remove then removes all unit, port and the adapter data structures. Removing the units requires that the SCSI devices are removed first. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Specify waiting times in ERP in secondsChristof Schmitt
It is not necessary to use jiffies or milliseconds to specify waiting times that last a couple of seconds. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Use also port and adapter to identify unit in messages.Christof Schmitt
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] zfcp: Remove unnecessary eh_bus_reset_handler callbackChristof Schmitt
The callback function used by zfcp always returns success, which is an indication for the SCSI midlayer to stop error handling. Remove the bus_reset callback, since the same function will be called via the host_reset callback. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-11-16[SCSI] zfcp: fix cleanup of dismissed error recovery actionsMartin Peschke
Calling zfcp_erp_strategy_check_action() after zfcp_erp_action_to_running() in zfcp_erp_strategy() might cause an unbalanced up() for erp_ready_sem, which makes the zfcp recovery fail somewhere along the way: erp thread processing erp_action: | | someone waking up erp thread for erp_action | | | | someone else dismissing erp_action: | | | V V V write_lock_irqsave(&adapter->erp_lock, flags); ... if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) { zfcp_erp_action_to_ready(erp_action); up(&adapter->erp_ready_sem); /* first up() for erp_action */ } write_unlock_irqrestore(&adapter->erp_lock, flags); write_lock_irqsave(&adapter->erp_lock, flags); ... zfcp_erp_action_to_running(erp_action); write_unlock_restore(&adapter->erp_lock, flags); /* processing erp_action */ write_lock_irqsave(&adapter->erp_lock, flags); ... erp_action->status |= ZFCP_STATUS_ERP_DISMISSED; if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) { zfcp_erp_action_to_ready(erp_action); up(&adapter->erp_ready_sem); /* second, unbalanced up() for erp_action */ } ... write_unlock_restore(&adapter->erp_lock, flags); write_lock_irqsave(&adapter->erp_lock, flags); if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) { zfcp_erp_action_dequeue(erp_action); retval = ZFCP_ERP_DISMISSED; } ... write_unlock_restore(&adapter->erp_lock, flags); down(&adapter->erp_ready_sem); /* this down() is meant to balance the first up() */ The erp thread must not dismiss an erp_action after moving that action to erp_running_head. Instead it should just go through the down() operation, which balances the first up(), and run through zfcp_erp_strategy one more time for the second up(), which eventually cleans up erp_action. Which is similar to the normal processing of an event for erp_action doing something asynchronously (e.g. waiting for the completion of an fsf_req). This only works if we make sure that a dismissed erp_action is passed to zfcp_erp_strategy() prior to the other action, which caused actions to be dismissed. Therefore the patch implements this rule: running actions go to the head of the ready list; new actions go to the tail of the ready list; the erp thread picks actions to be processed from the ready list's head. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Acked-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>