summaryrefslogtreecommitdiff
path: root/drivers/scsi
AgeCommit message (Collapse)Author
2010-10-29[SCSI] pmcraid: add support for set timestamp command and other fixesAnil Ravindranath
The following are the fixes in this patch: 1. Added support of set timestamp command in the driver 2. Pass all status code to mgmt application. Earlier we were passing only failed ones. 3. Call class_destroy after unregister_chrdev and pci_unregister_driver Signed-off-by: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] pmcraid: remove duplicate struct memberAnil Ravindranath
sense_buffer is both a direct member of struct pmcraid_cmd as well as an indirect one via an anonymous union and struct. Fix this clash by eliminating the direct member in favour of the anonymous struct/union one. The name duplication apparently isn't noticed by gcc versions earlier than 4.4 Reported-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] qla4xxx: Fix cmd check in qla4xxx_cmd_waitMike Christie
If the command has timedout then the block layer has called blk_mark_rq_complete. If qla4xxx_cmd_wait is then called from qla4xxx_eh_host_reset, we will always fail, because if the driver calls scsi_done then the the block layer will fail at blk_complete_request's blk_mark_rq_complete call instead of calling the normal completion path including the function, blk_queue_end_tag, which releases the tag. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] megaraid_sas: Version and documentation updateYang, Bo
Signed-off-by Bo Yang <bo.yang@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] megaraid_sas: Add three times Online controller resetYang, Bo
If fw didn't raise the interrupt with the fw state change to driver and fw goes to failure state, driver Will check the FW state in driver's timeout routine and issue the reset if need. Driver will do the OCR upto three times until kill adapter. Also driver will issue OCR before driver kill adapter even if fw in operational state. Signed-off-by Bo Yang <bo.yang@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] megaraid_sas: Add input parameter for max_sectorsYang, Bo
Driver add the input parameters support for max_sectors for megaraid sas gen2 chip. Customer can set the max_sectors support to 1MB for gen2 chip during the driver load. Signed-off-by Bo Yang <bo.yang@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] megaraid_sas: support devices update flagYang, Bo
Driver added the Device update flag to tell LSI application driver whether to do the device Update. LSI MegaRAID SAS application will check this flag to decide if it needs to update the Device or not. Signed-off-by Bo Yang <bo.yang@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] libosd: write/read_sg_kern APIBoaz Harrosh
This is a trivial addition to the SG API that can receive kernel pointers. It is only used by the out-of-tree test module. So it's immediate need is questionable. For maintenance ease it might just get in, as it's very small. John. do you need this in the Kernel, or is it only for osd_ktest.ko? Signed-off-by: John A. Chandy <john.chandy@uconn.edu> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] libosd: Support for scatter gather write/read commandsBoaz Harrosh
This patch adds the Scatter-Gather (sg) API to libosd. Scatter-gather enables a write/read of multiple none-contiguous areas of an object, in a single call. The extents may overlap and/or be in any order. The Scatter-Gather list is sent to the target in what is called a "cdb continuation segment". This is yet another possible segment in the osd-out-buffer. It is unlike all other segments in that it sits before the actual "data" segment (which until now was always first), and that it is signed by itself and not part of the data buffer. This is because the cdb-continuation-segment is considered a spill-over of the CDB data, and is therefor signed under OSD_SEC_CAPKEY and higher. TODO: A new osd_finalize_request_ex version should be supplied so the @caps received on the network also contains a size parameter and can be spilled over into the "cdb continuation segment". Thanks to John Chandy <john.chandy@uconn.edu> for the original code, and investigations. And the implementation of SG support in the osd-target. Original-coded-by: John Chandy <john.chandy@uconn.edu> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] libosd: Free resources in reverse order of allocationBoaz Harrosh
At osd_end_request first free the request that might point to pages, then free these pages. In reverse order of allocation. For now it's just anal neatness. When we'll use mempools It'll also pay in performance. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] libosd: Fix bug in attr_page handlingBoaz Harrosh
The _osd_req_finalize_attr_page was off by a mile, when trying to append the enc_get_attr segment instead of the proper set_attr segment. Also properly support when we don't have any attribute to set while getting a full page. And when clearing an attribute by setting it's size to zero. Reported-by: John Chandy <john.chandy@uconn.edu> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] lpfc 8.3.18: Update lpfc driver version to 8.3.18James Smart
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] lpfc 8.3.18: Add new WQE supportJames Smart
- Add new WQE fields as defined by new SLI interface to support new hardware. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] lpfc 8.3.18: Fix critical errorsJames Smart
Fix critical errors - Update send_scsi_event to validate pnode pointer active before copying the wwpn information. - Add a message, mailbox_idle, and unlock before failing SECURITY_MGMT or AUTH_PORT mailbox commands - Prevent spin_lock_irqsave from being called twice in a row. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] lpfc 8.3.18: Adapter Shutdown and Unregistration cleanupJames Smart
Adapter Shutdown and Unregistration cleanup - Correct the logic around hba shutdown. Prior to final reset, the driver must wait for all XRIs to return from the adapter. Added logic to poll, progressively slowing the poll rate as delay gets longer. - Correct behavior around the rsvd1 field in UNREG_RPI_ALL mailbox completion and final rpi cleanup. - Updated logic to move pending VPI registrations to their completion in cases where a CVL may be received while registration in progress. - Added unreg all rpi mailbox command before unreg vpi. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-26[SCSI] lpfc 8.3.18: Add logic to detect last devloss timeoutJames Smart
Added driver logic to detect the last devloss timeout of remote nodes which was still in use of FCF. At that point, the driver should set the last in-use remote node devloss timeout flag if it was not already set and should perform proper action on the in-use FCF and recover of FCF from firmware, depending on the state the driver's FIP engine is in. Find eligible FCF through FCF table rescan or the next new FCF event when FCF table rescan turned out empty eligible FCF, and the successful flogi into an FCF shall clear the HBA_DEVLOSS_TMO flag, indicating the successful recovery from devloss timeout. [jejb: add delay.h include to lpfc_hbadisc.c to fix ppc compile] Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] lpfc 8.3.18: Add support of received ELS commandsJames Smart
Add support of received ELS commands - Add support for received RLS ELS command - Add support for received ECHO ELS command - Add support for received RTV ELS command Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] lpfc 8.3.18: FC/FCoE Discovery fixesJames Smart
FC/FCoE Discovery fixes: - Call the lpfc_drain_txq only for SLI4 hba - In lpfc_cmpl_els_fdisc, fix code path that does not free IOCB. - Treated firmware matching FCF property with different index as error - Propagate error returns from lpfc_issue_els_flogi() - Refactored lpfc_unregister_unused_fcf() to create a post lpfc_dev_loss_tmo handler call for SLI-4 devices. Allows checking of fcf after last ndlp released so that fcf can be released if no longer in use. - Replaced individual FCF_XXXX_DISC flag clearing in lieu of aggregate FCF_DISCOVERY flag upon succesful completion of flogi. - Correct setting of altBbCredit value in sparams to correct issue with logins with remote loop-based devices. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] ipr: add definitions for a new adapterWayne Boyer
There was an addition to the hardware roadmap that includes a new adapter. This patch adds the new definitions for the adapter. Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com> Acked-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: fix comments for c filesJing Huang
This patch addresses the comments from Randy Dunlap (Randy.Dunlap@oracle.com) regarding comment blocks that begining with "/**". bfa driver comments currently do not follow kernel-doc convention, we hence replace all /** with /* and **/ with */. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: fix comments for header filesJing Huang
This patch addresses the comments from Randy Dunlap (Randy.Dunlap@oracle.com) regarding comment blocks that begining with "/**". bfa driver comments currently do not follow kernel-doc convention, we hence replace all /** with /* and **/ with */. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: fix frame size over 1024 compile warningJing Huang
Fix compile warning for frame size over 1024 in gcc 4.4. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: remove os wrapper functions and macrosJing Huang
This patch replaces register access functions and macros with the the ones provided by linux. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: replace endian swap macros with the ones provided by linuxJing Huang
Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] bfa: remove os wrapper and unused functionsJing Huang
This patch removes os wrapper and unused functions. bfa_os_assign(), bfa_os_memset(), bfa_os_memcpy(), bfa_os_udelay() bfa_os_vsprintf(), bfa_os_snprintf(), and bfa_os_get_clock() are replaced with direct assignment or native linux functions. Some unused functions related to VF (Vitual fabric) are also removed. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] scsi_dh_rdac: Add two new SUN devices to rdac_dev_listChauhan, Vijay
Signed-off-by: Vijay Chauhan <vijay.chauhan@lsi.com> Acked-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] cxgb4i: ignore informational act-open-rpl messageKaren Xie
Ignore active open reply with status negative advice. This is an informational message. Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Avoid depending on SCSI host_lock in queuecommand function.Giridhar Malavali
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Correct PRLI failure response code handling.Andrew Vasquez
This patch fixes an issue which causes the firmware to fail with a 'PRLI failed' status code (iop1 = 405). This status triggers the driver to fall into an incorrect code-path which does not attempt a login retry. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Drop srb reference before waiting for completion.Mike Christie
This patch fixes a regression introduced by commit 083a469db4ecf3b286a96b5b722c37fc1affe0be qla2xxx_eh_wait_on_command() is waiting for an srb to complete, which will never happen as the routine took a reference to the srb previously and will only drop it after this function. So every command abort will fail. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Addition of shutdown callback handler.Madhuranath Iyengar
This patch adds a shutdown handler to qla2xxx driver to make sure that all DMA and firmware activities are stopped, and any associated driver resources are released. The need for this handler arose when executing kexec in specific environments caused the data of the 2nd kernel to be corrupted, due to DMA activities. Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Initialize the vport_slock spinlock.Andrew Vasquez
Commit feafb7b1714cf599a6d0fed45801ab3f66046cbd neglected to initialize the spinlock. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Remove scsi_cmnd->serial_number from debug tracesMadhuranath Iyengar
This patch cleans up any printk or debug tracing of the the serial_number field in the qla2xxx driver. Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Add flash read/update support using BSG interfaceHarish Zunjarrao
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Group CS_RESET return status with other link level event ↵Chad Dupuis
statuses. Currently when we receive a CS_RESET as a response for a SCSI command the driver will return DID_TRANSPORT_DISRUPTED back to the SCSI mid-layer. There are certain circumstances where this could cause the mid-layer to exhaust all of its retries if the FC port goes away for a short time. This will result in commands being prematurly failed. Moving the CS_RESET return code to be grouped with other link level events will cause the FC transport layer to block that target's queue thus preventing the premature exhaustion of retries. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Change del_timer_sync() to del_timer() in qla2x00_ctx_sp_free().Chad Dupuis
Using del_timer_sync() in the qla2x00_ctx_sp_free() function may cause a kernel panic as it is not interrupt context safe and qla2x00_ctx_sp_free() may be called from a softirq context. Changing the call from del_timer_sync() to del_timer() will make the function interrupt context safe. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Add module parameter to enable/disable GFF_ID device type check.Chad Dupuis
Add the module parameter ql2xgffidenable to disable/enable the use of the GFF_ID name server command to prevent non FCP SCSI devices from being added to the driver's internal fc_port database. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: Remove port down retry count.Chad Dupuis
This patch removes the use of the port down retry counter as a mechanism to update a fcport state. The internal driver counter is a residual carry-over from pre-FC-transport aware driver inteaction. The ql2xport_down_retry module parameter and NVRAM set ha->port_down_retry_count remain in order to seed the fc-host's default dev-loss-tmo. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] qla2xxx: locking problem in qla2x00_init_rings()Dan Carpenter
IRQs are already disabled here so we don't need to disable them again. But more importantly, the spin_lock_irqsave() overwrites "flags" and that breaks things when we want to re-enable the IRQs when we call spin_unlock_irqrestore(&ha->hardware_lock, flags); Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] sr: fix sr_drive_status handling when initialization requiredRobert Jennings
An sr device that reports sense data with SK/ASC/ASCQ of 2/4/2 (Not ready, Logical unit not ready, Initializing command required) will be handled in sr_drive_status as (2/4/!1) and assumed to be a 'format in progress' which returns CDS_DISC_OK. The drive will not be made ready in this case. Prior to 210ba1d1724f5c4ed87a2ab1a21ca861a915f734 sr_drive_status would have returned CDS_TRAY_OPEN and this results in an START_STOP_UNIT to close the tray, which resolves the initialization requirement. This patch adds handling for SK/ASC/ASCQ of 2/4/2 where it will return CDS_TRAY_OPEN as a means of triggering a START_STOP_UNIT. This issue is seen on the IBM POWER platform when using a file-backed, virtual optical device. The device does not support media queries through the Get Event Status Notification command which could otherwise trigger a START_STOP_UNIT call to close an open tray. Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] fcoe: Fix broken NPIV with correction to MAC validationRobert Love
A previous patch attempted to validate the destination MAC address of a FCoE frame by checking that MAC address against the received port's MAC address. The implementation seems fine on the surface, but any VN_Ports added using the NPIV feature will have their own MAC addresses and these MACs were not being checked, which prevented any NPIV VN_Ports from receiving frames. In other words, the following patch has broken NPIV. 519e5135e2537c9dbc1cbcc0891b0a936ff5dcd2 [SCSI] fcoe: adds src and dest mac address checking for fcoe frames Part of the offending patch is correct, but the part that broke NPIV was attempting to satisfy FC-BB-5 section D.5, 2.1- (discard frames that) "contain a destination MAC address/destination N_Port_ID pair that was not assigned by an FCF to one of the VN_Ports on the ENode" The language does _not_ say to compare the destination FC-MAP/destination N_Port_ID, but instead to compare the destination MAC address/destination N_Port_ID. >From the FC-BB-5 specification, "A properly formed FPMA is one in which the 24 most significant bits equal the Fabric’s FC-MAP value and the least significant 24 bits equal the N_Port_ID assigned to the VN_Port by the FCF." This means that we need to compare the FC Frame's destination FCID against the embedded FCID in the destination MAC address. This patch checks the lower 24 bits of the destination MAC address against destination FCID in the Fibre Channel frame. For MAC validation the first line of defense is the hardware MAC filtering. Each VN_Port will have a unicast MAC addresses added to the hardware's filtering table. The Ethernet driver should drop any MACs not destined for a programmed MAC. This patch adds a second line of defense that very specfically compares an element in the FC frame against an element in the Ethernet header, which is appropriate for the FCoE layer. Many alternative approaches were considered, including a LLD callback from libfc. The second most reasonable approach seemed to be walking the list of NPIV ports and check each of their MAC addresses against the destination MAC address of the received frame. The problem with this approach was that it is likely that performance would suffer with the more NPIV ports added to the system since every received frame would need to walk this list, comparing each entry's MAC. Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfcoe: VN2VN connection setup causing stack memory corruption.Kiran Patil
Fix: When FIP frame is received, function fcoe_ctlr_vn_recv calls function fcoe_ctlr_vn_parse which does memset for addr (&buf.rdata) which leads to memory corruption. Code was trying to treat "buf" as struct but it was defined as union. Fix is to change from union to struct for "buf" in function fcoe_ctlr_vn_recv. Technical Details: N/A Signed-off-by: Kiran Patil <kiran.patil@intel.com> Acked-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfc: Do not let disc work cancel itselfBhanu Prakash Gollapudi
When number of NPIV ports created are greater than the xids allocated per pool -- for eg., creating 255 NPIV ports on a system with nr_cpu_ids of 32, with each pool containing 128 xids -- and then generating a link event - for eg., shutdown/no shutdown -- on the switch port causes the hang with the following stack trace. Call Trace: schedule_timeout+0x19d/0x230 wait_for_common+0xc0/0x170 __cancel_work_timer+0xcf/0x1b0 fc_disc_stop+0x16/0x30 [libfc] fc_lport_reset_locked+0x47/0x90 [libfc] fc_lport_enter_reset+0x67/0xe0 [libfc] fc_lport_disc_callback+0xbc/0xe0 [libfc] fc_disc_done+0xa8/0xf0 [libfc] fc_disc_timeout+0x29/0x40 [libfc] run_workqueue+0xb8/0x140 worker_thread+0x96/0x110 kthread+0x96/0xa0 child_rip+0xa/0x20 Fix is to not cancel the disc_work if discovery is already stopped, thus allowing lport state machine to restart and try discovery again. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Acked-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfc: possible race could panic system due to NULL fsp->cmdVasu Dev
It is unlikely but in case if it hits then it would cause panic due to null cmd ptr, so far only one instance seen recently with ESX though this was introduced long ago with this commit:- commit c1ecb90a66c5afc7cc5c9349f9c3714eef4a5cfb Author: Chris Leech <christopher.leech@intel.com> Date: Thu Dec 10 09:59:26 2009 -0800 [SCSI] libfc: reduce hold time on SCSI host lock Currently fsp->cmd is set to NULL w/o scsi_queue_lock before dequeuing from scsi_pkt_queue and that could cause NULL fsp->cmd in fc_fcp_cleanup_each_cmd for cmd completing with fsp->cmd = NULL after fc_fcp_cleanup_each_cmd taken reference. No need to set fsp->cmd to NULL as this is also protected by fc_fcp_lock_pkt(), for above race the fc_fcp_lock_pkt() in fc_fcp_cleanup_each_cmd() will fail as that cmd is already done. Mike mentioned same issue at http://www.open-fcoe.org/pipermail/devel/2010-September/010533.html Similarly moved sc_cmd->SCp.ptr = NULL under scsi_queue_lock so that scsi abort error handler won't abort on completed cmds. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] fcoe: set default FIP mode as FIP_MODE_FABRICVasu Dev
Since sometimes current FIP_MODE_AUTO mode falls back to non-FIP mode while DCB link still getting ready in fabric mode with its peer switch, it falls back after few libfc flogi retries and that is not we want while working with FIP enabled switches in FABRIC mode, therefore sets default as FIP_MODE_FABRIC as discussed and agreed before in this mail thread http://www.open-fcoe.org/pipermail/devel/2010-August/010511.html Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfc: adds flogi retry in case DID is zero in RJTVasu Dev
Sometimes switch in NPV mode rejects flogi request with DID zero and in that case flogi is not tried again and port remains offline, so this patch validates DID for non zero along with only ACC response to allow flogi retry for RJT with DID=0 also succeed FLOGI in next try. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfc: use DID_TRANSPORT_DISRUPTED while lport not readyVasu Dev
This is per Mile Christie feedback since in this case IO could get retried for tape devices and therefore DID_REQUEUE cannot be used, more details in this thread. http://marc.info/?l=linux-scsi&m=127970522630136&w=2 Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] libfc: fix setting of rport dev lossMike Christie
There does not seem to be a reason why libfc adds a 5 second delay to the user requested value for the dev loss tmo. There also does not seem to be a reason to allow setting it to 0 (or really close). This patch removes the extra 5 sec delay, and for 0 it sets it to 1 like other fc drivers. We should actually be able to set it to 0 since the queue_delayed_work API will just call queue_work, but other drivers set it to 1 in that case. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] gdth: integer overflow in ioctlDan Carpenter
gdth_ioctl_alloc() takes the size variable as an int. copy_from_user() takes the size variable as an unsigned long. gen.data_len and gen.sense_len are unsigned longs. On x86_64 longs are 64 bit and ints are 32 bit. We could pass in a very large number and the allocation would truncate the size to 32 bits and allocate a small buffer. Then when we do the copy_from_user(), it would result in a memory corruption. CC: stable@kernel.org Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25[SCSI] Fix race when removing SCSI devicesChristof Schmitt
Removing SCSI devices through echo 1 > /sys/bus/scsi/devices/ ... /delete while the FC transport class removes the SCSI target can lead to an oops: Unable to handle kernel pointer dereference at virtual kernel address 00000000b6815000 Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: sunrpc qeth_l3 binfmt_misc dm_multipath scsi_dh dm_mod ipv6 qeth ccwgroup [last unloaded: scsi_wait_scan] CPU: 1 Not tainted 2.6.35.5-45.x.20100924-s390xdefault #1 Process fc_wq_0 (pid: 861, task: 00000000b7331240, ksp: 00000000b735bac0) Krnl PSW : 0704200180000000 00000000003ff6e4 (__scsi_remove_device+0x24/0xd0) R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3 Krnl GPRS: 0000000000000001 0000000000000000 00000000b6815000 00000000bc24a8c0 00000000003ff7c8 000000000056dbb8 0000000000000002 0000000000835d80 ffffffff00000000 0000000000001000 00000000b6815000 00000000bc24a7f0 00000000b68151a0 00000000b6815000 00000000b735bc20 00000000b735bbf8 Krnl Code: 00000000003ff6d6: a7840001 brc 8,3ff6d8 00000000003ff6da: a7fbffd8 aghi %r15,-40 00000000003ff6de: e3e0f0980024 stg %r14,152(%r15) >00000000003ff6e4: e31021200004 lg %r1,288(%r2) 00000000003ff6ea: a71f0000 cghi %r1,0 00000000003ff6ee: a7a40011 brc 10,3ff710 00000000003ff6f2: a7390003 lghi %r3,3 00000000003ff6f6: c0e5ffffc8b1 brasl %r14,3f8858 Call Trace: ([<0000000000001000>] 0x1000) [<00000000003ff7d2>] scsi_remove_device+0x42/0x54 [<00000000003ff8ba>] __scsi_remove_target+0xca/0xfc [<00000000003ff99a>] __remove_child+0x3a/0x48 [<00000000003e3246>] device_for_each_child+0x72/0xbc [<00000000003ff93a>] scsi_remove_target+0x4e/0x74 [<0000000000406586>] fc_rport_final_delete+0xb2/0x23c [<000000000015d080>] worker_thread+0x200/0x344 [<000000000016330c>] kthread+0xa0/0xa8 [<0000000000106c1a>] kernel_thread_starter+0x6/0xc [<0000000000106c14>] kernel_thread_starter+0x0/0xc INFO: lockdep is turned off. Last Breaking-Event-Address: [<00000000003ff7cc>] scsi_remove_device+0x3c/0x54 The function __scsi_remove_target iterates through the SCSI devices on the host, but it drops the host_lock before calling scsi_remove_device. When the SCSI device is deleted from another thread, the pointer to the SCSI device in scsi_remove_device can become invalid. Fix this by getting a reference to the SCSI device before dropping the host_lock to keep the SCSI device alive for the call to scsi_remove_device. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>