···11+Release Date : Fri May 19 09:31:45 EST 2006 - Seokmann Ju <sju@lsil.com>22+Current Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module)33+Older Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)44+55+1. Fixed a bug in megaraid_init_mbox().66+ Customer reported "garbage in file on x86_64 platform".77+ Root Cause: the driver registered controllers as 64-bit DMA capable88+ for those which are not support it.99+ Fix: Made change in the function inserting identification machanism1010+ identifying 64-bit DMA capable controllers.1111+1212+ > -----Original Message-----1313+ > From: Vasily Averin [mailto:vvs@sw.ru]1414+ > Sent: Thursday, May 04, 2006 2:49 PM1515+ > To: linux-scsi@vger.kernel.org; Kolli, Neela; Mukker, Atul;1616+ > Ju, Seokmann; Bagalkote, Sreenivas;1717+ > James.Bottomley@SteelEye.com; devel@openvz.org1818+ > Subject: megaraid_mbox: garbage in file1919+ >2020+ > Hello all,2121+ >2222+ > I've investigated customers claim on the unstable work of2323+ > their node and found a2424+ > strange effect: reading from some files leads to the2525+ > "attempt to access beyond end of device" messages.2626+ >2727+ > I've checked filesystem, memory on the node, motherboard BIOS2828+ > version, but it2929+ > does not help and issue still has been reproduced by simple3030+ > file reading.3131+ >3232+ > Reproducer is simple:3333+ >3434+ > echo 0xffffffff >/proc/sys/dev/scsi/logging_level ;3535+ > cat /vz/private/101/root/etc/ld.so.cache >/tmp/ttt ;3636+ > echo 0 >/proc/sys/dev/scsi/logging3737+ >3838+ > It leads to the following messages in dmesg3939+ >4040+ > sd_init_command: disk=sda, block=871769260, count=264141+ > sda : block=8717692604242+ > sda : reading 26/26 512 byte blocks.4343+ > scsi_add_timer: scmd: f79ed980, time: 7500, (c02b1420)4444+ > sd 0:1:0:0: send 0xf79ed980 sd 0:1:0:0:4545+ > command: Read (10): 28 00 33 f6 24 ac 00 00 1a 004646+ > buffer = 0xf7cfb540, bufflen = 13312, done = 0xc0366b40,4747+ > queuecommand 0xc03440104848+ > leaving scsi_dispatch_cmnd()4949+ > scsi_delete_timer: scmd: f79ed980, rtn: 15050+ > sd 0:1:0:0: done 0xf79ed980 SUCCESS 0 sd 0:1:0:0:5151+ > command: Read (10): 28 00 33 f6 24 ac 00 00 1a 005252+ > scsi host busy 1 failed 05353+ > sd 0:1:0:0: Notifying upper driver of completion (result 0)5454+ > sd_rw_intr: sda: res=0x05555+ > 26 sectors total, 13312 bytes done.5656+ > use_sg is 45757+ > attempt to access beyond end of device5858+ > sda6: rw=0, want=1044134458, limit=9514013675959+ > Buffer I/O error on device sda6, logical block 5220672286060+ > attempt to access beyond end of device6161+6262+2. When INQUIRY with EVPD bit set issued to the MegaRAID controller,6363+ system memory gets corrupted.6464+ Root Cause: MegaRAID F/W handle the INQUIRY with EVPD bit set6565+ incorrectly.6666+ Fix: MegaRAID F/W has fixed the problem and being process of release,6767+ soon. Meanwhile, driver will filter out the request.6868+6969+3. One of member in the data structure of the driver leads unaligne7070+ issue on 64-bit platform.7171+ Customer reporeted "kernel unaligned access addrss" issue when7272+ application communicates with MegaRAID HBA driver.7373+ Root Cause: in uioc_t structure, one of member had misaligned and it7474+ led system to display the error message.7575+ Fix: A patch submitted to community from following folk.7676+7777+ > -----Original Message-----7878+ > From: linux-scsi-owner@vger.kernel.org7979+ > [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Sakurai Hiroomi8080+ > Sent: Wednesday, July 12, 2006 4:20 AM8181+ > To: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org8282+ > Subject: Re: Help: strange messages from kernel on IA64 platform8383+ >8484+ > Hi,8585+ >8686+ > I saw same message.8787+ >8888+ > When GAM(Global Array Manager) is started, The following8989+ > message output.9090+ > kernel: kernel unaligned access to 0xe0000001fe1080d4,9191+ > ip=0xa0000002000533719292+ >9393+ > The uioc structure used by ioctl is defined by packed,9494+ > the allignment of each member are disturbed.9595+ > In a 64 bit structure, the allignment of member doesn't fit 64 bit9696+ > boundary. this causes this messages.9797+ > In a 32 bit structure, we don't see the message because the allinment9898+ > of member fit 32 bit boundary even if packed is specified.9999+ >100100+ > patch101101+ > I Add 32 bit dummy member to fit 64 bit boundary. I tested.102102+ > We confirmed this patch fix the problem by IA64 server.103103+ >104104+ > **************************************************************105105+ > ****************106106+ > --- linux-2.6.9/drivers/scsi/megaraid/megaraid_ioctl.h.orig107107+ > 2006-04-03 17:13:03.000000000 +0900108108+ > +++ linux-2.6.9/drivers/scsi/megaraid/megaraid_ioctl.h109109+ > 2006-04-03 17:14:09.000000000 +0900110110+ > @@ -132,6 +132,10 @@111111+ > /* Driver Data: */112112+ > void __user * user_data;113113+ > uint32_t user_data_len;114114+ > +115115+ > + /* 64bit alignment */116116+ > + uint32_t pad_0xBC;117117+ > +118118+ > mraid_passthru_t __user *user_pthru;119119+ >120120+ > mraid_passthru_t *pthru32;121121+ > **************************************************************122122+ > ****************123123+1124Release Date : Mon Apr 11 12:27:22 EST 2006 - Seokmann Ju <sju@lsil.com>2125Current Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)3126Older Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module)
+2-1
arch/ia64/hp/sim/simscsi.c
···244244245245 if (scatterlen == 0)246246 memcpy(sc->request_buffer, buf, len);247247- else for (slp = (struct scatterlist *)sc->request_buffer; scatterlen-- > 0 && len > 0; slp++) {247247+ else for (slp = (struct scatterlist *)sc->request_buffer;248248+ scatterlen-- > 0 && len > 0; slp++) {248249 unsigned thislen = min(len, slp->length);249250250251 memcpy(page_address(slp->page) + slp->offset, buf, thislen);
+2-20
drivers/infiniband/ulp/iser/iscsi_iser.c
···378378 return iser_conn_set_full_featured_mode(conn);379379}380380381381-static void382382-iscsi_iser_conn_terminate(struct iscsi_conn *conn)383383-{384384- struct iscsi_iser_conn *iser_conn = conn->dd_data;385385- struct iser_conn *ib_conn = iser_conn->ib_conn;386386-387387- BUG_ON(!ib_conn);388388- /* starts conn teardown process, waits until all previously *389389- * posted buffers get flushed, deallocates all conn resources */390390- iser_conn_terminate(ib_conn);391391- iser_conn->ib_conn = NULL;392392- conn->recv_lock = NULL;393393-}394394-395395-396381static struct iscsi_transport iscsi_iser_transport;397382398383static struct iscsi_cls_session *···540555static void541556iscsi_iser_ep_disconnect(__u64 ep_handle)542557{543543- struct iser_conn *ib_conn = iscsi_iser_ib_conn_lookup(ep_handle);558558+ struct iser_conn *ib_conn;544559560560+ ib_conn = iscsi_iser_ib_conn_lookup(ep_handle);545561 if (!ib_conn)546562 return;547563548564 iser_err("ib conn %p state %d\n",ib_conn, ib_conn->state);549549-550565 iser_conn_terminate(ib_conn);551566}552567···599614 .get_session_param = iscsi_session_get_param,600615 .start_conn = iscsi_iser_conn_start,601616 .stop_conn = iscsi_conn_stop,602602- /* these are called as part of conn recovery */603603- .suspend_conn_recv = NULL, /* FIXME is/how this relvant to iser? */604604- .terminate_conn = iscsi_iser_conn_terminate,605617 /* IO */606618 .send_pdu = iscsi_conn_send_pdu,607619 .get_stats = iscsi_iser_conn_get_stats,
···5252/********************* GENERAL DEFINES *********************************/53535454/* zfcp version number, it consists of major, minor, and patch-level number */5555-#define ZFCP_VERSION "4.7.0"5555+#define ZFCP_VERSION "4.8.0"56565757/**5858 * zfcp_sg_to_address - determine kernel address from struct scatterlist···8080#define REQUEST_LIST_SIZE 12881818282/********************* SCSI SPECIFIC DEFINES *********************************/8383-#define ZFCP_SCSI_ER_TIMEOUT (100*HZ)8383+#define ZFCP_SCSI_ER_TIMEOUT (10*HZ)84848585/********************* CIO/QDIO SPECIFIC DEFINES *****************************/8686···886886 struct list_head port_remove_lh; /* head of ports to be887887 removed */888888 u32 ports; /* number of remote ports */889889- struct timer_list scsi_er_timer; /* SCSI err recovery watch */890890- struct list_head fsf_req_list_head; /* head of FSF req list */891891- spinlock_t fsf_req_list_lock; /* lock for ops on list of892892- FSF requests */893893- atomic_t fsf_reqs_active; /* # active FSF reqs */889889+ struct timer_list scsi_er_timer; /* SCSI err recovery watch */890890+ atomic_t reqs_active; /* # active FSF reqs */891891+ unsigned long req_no; /* unique FSF req number */892892+ struct list_head *req_list; /* list of pending reqs */893893+ spinlock_t req_list_lock; /* request list lock */894894 struct zfcp_qdio_queue request_queue; /* request queue */895895 u32 fsf_req_seq_no; /* FSF cmnd seq number */896896 wait_queue_head_t request_wq; /* can be used to wait for···986986/* FSF request */987987struct zfcp_fsf_req {988988 struct list_head list; /* list of FSF requests */989989+ unsigned long req_id; /* unique request ID */989990 struct zfcp_adapter *adapter; /* adapter request belongs to */990991 u8 sbal_number; /* nr of SBALs free for use */991992 u8 sbal_first; /* first SBAL for this request */
+73-137
drivers/s390/scsi/zfcp_erp.c
···6464static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *);6565static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *, int);6666static int zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *);6767-static int zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *);6868-static int zfcp_erp_adapter_strategy_close_fsf(struct zfcp_erp_action *);6767+static void zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *);6868+static void zfcp_erp_adapter_strategy_close_fsf(struct zfcp_erp_action *);6969static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *);7070static int zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *);7171static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *);···9393static int zfcp_erp_unit_strategy_close(struct zfcp_erp_action *);9494static int zfcp_erp_unit_strategy_open(struct zfcp_erp_action *);95959696-static int zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *);9797-static int zfcp_erp_action_dismiss_port(struct zfcp_port *);9898-static int zfcp_erp_action_dismiss_unit(struct zfcp_unit *);9999-static int zfcp_erp_action_dismiss(struct zfcp_erp_action *);9696+static void zfcp_erp_action_dismiss_port(struct zfcp_port *);9797+static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *);9898+static void zfcp_erp_action_dismiss(struct zfcp_erp_action *);10099101100static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *,102101 struct zfcp_port *, struct zfcp_unit *);···134135 zfcp_erp_adapter_reopen(adapter, 0);135136}136137137137-/*138138- * function: zfcp_fsf_scsi_er_timeout_handler138138+/**139139+ * zfcp_fsf_scsi_er_timeout_handler - timeout handler for scsi eh tasks139140 *140140- * purpose: This function needs to be called whenever a SCSI error recovery141141- * action (abort/reset) does not return.142142- * Re-opening the adapter means that the command can be returned143143- * by zfcp (it is guarranteed that it does not return via the144144- * adapter anymore). The buffer can then be used again.145145- * 146146- * returns: sod all141141+ * This function needs to be called whenever a SCSI error recovery142142+ * action (abort/reset) does not return. Re-opening the adapter means143143+ * that the abort/reset command can be returned by zfcp. It won't complete144144+ * via the adapter anymore (because qdio queues are closed). If ERP is145145+ * already running on this adapter it will be stopped.147146 */148148-void149149-zfcp_fsf_scsi_er_timeout_handler(unsigned long data)147147+void zfcp_fsf_scsi_er_timeout_handler(unsigned long data)150148{151149 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;150150+ unsigned long flags;152151153152 ZFCP_LOG_NORMAL("warning: SCSI error recovery timed out. "154153 "Restarting all operations on the adapter %s\n",155154 zfcp_get_busid_by_adapter(adapter));156155 debug_text_event(adapter->erp_dbf, 1, "eh_lmem_tout");157157- zfcp_erp_adapter_reopen(adapter, 0);158156159159- return;157157+ write_lock_irqsave(&adapter->erp_lock, flags);158158+ if (atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING,159159+ &adapter->status)) {160160+ zfcp_erp_modify_adapter_status(adapter,161161+ ZFCP_STATUS_COMMON_UNBLOCKED|ZFCP_STATUS_COMMON_OPEN,162162+ ZFCP_CLEAR);163163+ zfcp_erp_action_dismiss_adapter(adapter);164164+ write_unlock_irqrestore(&adapter->erp_lock, flags);165165+ /* dismiss all pending requests including requests for ERP */166166+ zfcp_fsf_req_dismiss_all(adapter);167167+ adapter->fsf_req_seq_no = 0;168168+ } else169169+ write_unlock_irqrestore(&adapter->erp_lock, flags);170170+ zfcp_erp_adapter_reopen(adapter, 0);160171}161172162173/*···679670 return retval;680671}681672682682-/*683683- * function: 684684- *685685- * purpose: disable I/O,686686- * return any open requests and clean them up,687687- * aim: no pending and incoming I/O688688- *689689- * returns:673673+/**674674+ * zfcp_erp_adapter_block - mark adapter as blocked, block scsi requests690675 */691691-static void692692-zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int clear_mask)676676+static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int clear_mask)693677{694678 debug_text_event(adapter->erp_dbf, 6, "a_bl");695679 zfcp_erp_modify_adapter_status(adapter,···690688 clear_mask, ZFCP_CLEAR);691689}692690693693-/*694694- * function: 695695- *696696- * purpose: enable I/O697697- *698698- * returns:691691+/**692692+ * zfcp_erp_adapter_unblock - mark adapter as unblocked, allow scsi requests699693 */700700-static void701701-zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter)694694+static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter)702695{703696 debug_text_event(adapter->erp_dbf, 6, "a_ubl");704697 atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status);···845848 struct zfcp_adapter *adapter = erp_action->adapter;846849847850 if (erp_action->fsf_req) {848848- /* take lock to ensure that request is not being deleted meanwhile */849849- spin_lock(&adapter->fsf_req_list_lock);850850- /* check whether fsf req does still exist */851851- list_for_each_entry(fsf_req, &adapter->fsf_req_list_head, list)852852- if (fsf_req == erp_action->fsf_req)853853- break;854854- if (fsf_req && (fsf_req->erp_action == erp_action)) {851851+ /* take lock to ensure that request is not deleted meanwhile */852852+ spin_lock(&adapter->req_list_lock);853853+ if ((!zfcp_reqlist_ismember(adapter,854854+ erp_action->fsf_req->req_id)) &&855855+ (fsf_req->erp_action == erp_action)) {855856 /* fsf_req still exists */856857 debug_text_event(adapter->erp_dbf, 3, "a_ca_req");857858 debug_event(adapter->erp_dbf, 3, &fsf_req,858859 sizeof (unsigned long));859859- /* dismiss fsf_req of timed out or dismissed erp_action */860860+ /* dismiss fsf_req of timed out/dismissed erp_action */860861 if (erp_action->status & (ZFCP_STATUS_ERP_DISMISSED |861862 ZFCP_STATUS_ERP_TIMEDOUT)) {862863 debug_text_event(adapter->erp_dbf, 3,···887892 */888893 erp_action->fsf_req = NULL;889894 }890890- spin_unlock(&adapter->fsf_req_list_lock);895895+ spin_unlock(&adapter->req_list_lock);891896 } else892897 debug_text_event(adapter->erp_dbf, 3, "a_ca_noreq");893898894899 return retval;895900}896901897897-/*898898- * purpose: generic handler for asynchronous events related to erp_action events899899- * (normal completion, time-out, dismissing, retry after900900- * low memory condition)902902+/**903903+ * zfcp_erp_async_handler_nolock - complete erp_action901904 *902902- * note: deletion of timer is not required (e.g. in case of a time-out),903903- * but a second try does no harm,904904- * we leave it in here to allow for greater simplification905905- *906906- * returns: 0 - there was an action to handle907907- * !0 - otherwise905905+ * Used for normal completion, time-out, dismissal and failure after906906+ * low memory condition.908907 */909909-static int910910-zfcp_erp_async_handler_nolock(struct zfcp_erp_action *erp_action,911911- unsigned long set_mask)908908+static void zfcp_erp_async_handler_nolock(struct zfcp_erp_action *erp_action,909909+ unsigned long set_mask)912910{913913- int retval;914911 struct zfcp_adapter *adapter = erp_action->adapter;915912916913 if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) {···913926 del_timer(&erp_action->timer);914927 erp_action->status |= set_mask;915928 zfcp_erp_action_ready(erp_action);916916- retval = 0;917929 } else {918930 /* action is ready or gone - nothing to do */919931 debug_text_event(adapter->erp_dbf, 3, "a_asyh_gone");920932 debug_event(adapter->erp_dbf, 3, &erp_action->action,921933 sizeof (int));922922- retval = 1;923934 }924924-925925- return retval;926935}927936928928-/*929929- * purpose: generic handler for asynchronous events related to erp_action930930- * events (normal completion, time-out, dismissing, retry after931931- * low memory condition)932932- *933933- * note: deletion of timer is not required (e.g. in case of a time-out),934934- * but a second try does no harm,935935- * we leave it in here to allow for greater simplification936936- *937937- * returns: 0 - there was an action to handle938938- * !0 - otherwise937937+/**938938+ * zfcp_erp_async_handler - wrapper for erp_async_handler_nolock w/ locking939939 */940940-int941941-zfcp_erp_async_handler(struct zfcp_erp_action *erp_action,942942- unsigned long set_mask)940940+void zfcp_erp_async_handler(struct zfcp_erp_action *erp_action,941941+ unsigned long set_mask)943942{944943 struct zfcp_adapter *adapter = erp_action->adapter;945944 unsigned long flags;946946- int retval;947945948946 write_lock_irqsave(&adapter->erp_lock, flags);949949- retval = zfcp_erp_async_handler_nolock(erp_action, set_mask);947947+ zfcp_erp_async_handler_nolock(erp_action, set_mask);950948 write_unlock_irqrestore(&adapter->erp_lock, flags);951951-952952- return retval;953949}954950955951/*···969999 zfcp_erp_async_handler(erp_action, ZFCP_STATUS_ERP_TIMEDOUT);9701000}9711001972972-/*973973- * purpose: is called for an erp_action which needs to be ended974974- * though not being done,975975- * this is usually required if an higher is generated,976976- * action gets an appropriate flag and will be processed977977- * accordingly10021002+/**10031003+ * zfcp_erp_action_dismiss - dismiss an erp_action9781004 *979979- * locks: erp_lock held (thus we need to call another handler variant)10051005+ * adapter->erp_lock must be held10061006+ * 10071007+ * Dismissal of an erp_action is usually required if an erp_action of10081008+ * higher priority is generated.9801009 */981981-static int982982-zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action)10101010+static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action)9831011{9841012 struct zfcp_adapter *adapter = erp_action->adapter;9851013···9851017 debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int));98610189871019 zfcp_erp_async_handler_nolock(erp_action, ZFCP_STATUS_ERP_DISMISSED);988988-989989- return 0;9901020}99110219921022int···20402074 return retval;20412075}2042207620432043-/*20442044- * function: zfcp_qdio_cleanup20452045- *20462046- * purpose: cleans up QDIO operation for the specified adapter20472047- *20482048- * returns: 0 - successful cleanup20492049- * !0 - failed cleanup20772077+/**20782078+ * zfcp_erp_adapter_strategy_close_qdio - close qdio queues for an adapter20502079 */20512051-int20802080+static void20522081zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *erp_action)20532082{20542054- int retval = ZFCP_ERP_SUCCEEDED;20552083 int first_used;20562084 int used_count;20572085 struct zfcp_adapter *adapter = erp_action->adapter;···20542094 ZFCP_LOG_DEBUG("error: attempt to shut down inactive QDIO "20552095 "queues on adapter %s\n",20562096 zfcp_get_busid_by_adapter(adapter));20572057- retval = ZFCP_ERP_FAILED;20582058- goto out;20972097+ return;20592098 }2060209920612100 /*20622101 * Get queue_lock and clear QDIOUP flag. Thus it's guaranteed that20632102 * do_QDIO won't be called while qdio_shutdown is in progress.20642103 */20652065-20662104 write_lock_irq(&adapter->request_queue.queue_lock);20672105 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);20682106 write_unlock_irq(&adapter->request_queue.queue_lock);···20922134 adapter->request_queue.free_index = 0;20932135 atomic_set(&adapter->request_queue.free_count, 0);20942136 adapter->request_queue.distance_from_int = 0;20952095- out:20962096- return retval;20972137}2098213820992139static int···22142258 "%s)\n", zfcp_get_busid_by_adapter(adapter));22152259 ret = ZFCP_ERP_FAILED;22162260 }22172217- if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status)) {22182218- ZFCP_LOG_INFO("error: exchange port data failed (adapter "22612261+22622262+ /* don't treat as error for the sake of compatibility */22632263+ if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status))22642264+ ZFCP_LOG_INFO("warning: exchange port data failed (adapter "22192265 "%s\n", zfcp_get_busid_by_adapter(adapter));22202220- ret = ZFCP_ERP_FAILED;22212221- }2222226622232267 return ret;22242268}···22482292 return retval;22492293}2250229422512251-/*22522252- * function: zfcp_fsf_cleanup22532253- *22542254- * purpose: cleanup FSF operation for specified adapter22552255- *22562256- * returns: 0 - FSF operation successfully cleaned up22572257- * !0 - failed to cleanup FSF operation for this adapter22952295+/**22962296+ * zfcp_erp_adapter_strategy_close_fsf - stop FSF operations for an adapter22582297 */22592259-static int22982298+static void22602299zfcp_erp_adapter_strategy_close_fsf(struct zfcp_erp_action *erp_action)22612300{22622262- int retval = ZFCP_ERP_SUCCEEDED;22632301 struct zfcp_adapter *adapter = erp_action->adapter;2264230222652303 /*···22672317 /* all ports and units are closed */22682318 zfcp_erp_modify_adapter_status(adapter,22692319 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);22702270-22712271- return retval;22722320}2273232122742322/*···32413293}324232943243329532443244-static int32453245-zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)32963296+void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)32463297{32473247- int retval = 0;32483298 struct zfcp_port *port;3249329932503300 debug_text_event(adapter->erp_dbf, 5, "a_actab");···32513305 else32523306 list_for_each_entry(port, &adapter->port_list_head, list)32533307 zfcp_erp_action_dismiss_port(port);32543254-32553255- return retval;32563308}3257330932583258-static int32593259-zfcp_erp_action_dismiss_port(struct zfcp_port *port)33103310+static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)32603311{32613261- int retval = 0;32623312 struct zfcp_unit *unit;32633313 struct zfcp_adapter *adapter = port->adapter;32643314···32653323 else32663324 list_for_each_entry(unit, &port->unit_list_head, list)32673325 zfcp_erp_action_dismiss_unit(unit);32683268-32693269- return retval;32703326}3271332732723272-static int32733273-zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit)33283328+static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit)32743329{32753275- int retval = 0;32763330 struct zfcp_adapter *adapter = unit->port->adapter;3277333132783332 debug_text_event(adapter->erp_dbf, 5, "u_actab");32793333 debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t));32803334 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status))32813335 zfcp_erp_action_dismiss(&unit->erp_action);32823282-32833283- return retval;32843336}3285333732863338static inline void
···43434444#include "iscsi_tcp.h"45454646-#define ISCSI_TCP_VERSION "1.0-595"4747-4846MODULE_AUTHOR("Dmitry Yusupov <dmitry_yus@yahoo.com>, "4947 "Alex Aizman <itn780@yahoo.com>");5048MODULE_DESCRIPTION("iSCSI/TCP data-path");5149MODULE_LICENSE("GPL");5252-MODULE_VERSION(ISCSI_TCP_VERSION);5350/* #define DEBUG_TCP */5451#define DEBUG_ASSERT5552···182185 * must be called with session lock183186 */184187static void185185-__iscsi_ctask_cleanup(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)188188+iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)186189{187190 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;191191+ struct iscsi_r2t_info *r2t;188192 struct scsi_cmnd *sc;193193+194194+ /* flush ctask's r2t queues */195195+ while (__kfifo_get(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*))) {196196+ __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t,197197+ sizeof(void*));198198+ debug_scsi("iscsi_tcp_cleanup_ctask pending r2t dropped\n");199199+ }189200190201 sc = ctask->sc;191202 if (unlikely(!sc))···379374 spin_unlock(&session->lock);380375 return 0;381376 }377377+382378 rc = __kfifo_get(tcp_ctask->r2tpool.queue, (void*)&r2t, sizeof(void*));383379 BUG_ON(!rc);384380···405399 tcp_ctask->exp_r2tsn = r2tsn + 1;406400 tcp_ctask->xmstate |= XMSTATE_SOL_HDR;407401 __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*));408408- __kfifo_put(conn->xmitqueue, (void*)&ctask, sizeof(void*));402402+ list_move_tail(&ctask->running, &conn->xmitqueue);409403410404 scsi_queue_work(session->host, &conn->xmitwork);411405 conn->r2t_pdus_cnt++;···483477 case ISCSI_OP_SCSI_DATA_IN:484478 tcp_conn->in.ctask = session->cmds[itt];485479 rc = iscsi_data_rsp(conn, tcp_conn->in.ctask);480480+ if (rc)481481+ return rc;486482 /* fall through */487483 case ISCSI_OP_SCSI_CMD_RSP:488484 tcp_conn->in.ctask = session->cmds[itt];···492484 goto copy_hdr;493485494486 spin_lock(&session->lock);495495- __iscsi_ctask_cleanup(conn, tcp_conn->in.ctask);487487+ iscsi_tcp_cleanup_ctask(conn, tcp_conn->in.ctask);496488 rc = __iscsi_complete_pdu(conn, hdr, NULL, 0);497489 spin_unlock(&session->lock);498490 break;···508500 break;509501 case ISCSI_OP_LOGIN_RSP:510502 case ISCSI_OP_TEXT_RSP:511511- case ISCSI_OP_LOGOUT_RSP:512512- case ISCSI_OP_NOOP_IN:513503 case ISCSI_OP_REJECT:514504 case ISCSI_OP_ASYNC_EVENT:505505+ /*506506+ * It is possible that we could get a PDU with a buffer larger507507+ * than 8K, but there are no targets that currently do this.508508+ * For now we fail until we find a vendor that needs it509509+ */510510+ if (DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH <511511+ tcp_conn->in.datalen) {512512+ printk(KERN_ERR "iscsi_tcp: received buffer of len %u "513513+ "but conn buffer is only %u (opcode %0x)\n",514514+ tcp_conn->in.datalen,515515+ DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, opcode);516516+ rc = ISCSI_ERR_PROTO;517517+ break;518518+ }519519+515520 if (tcp_conn->in.datalen)516521 goto copy_hdr;517522 /* fall through */523523+ case ISCSI_OP_LOGOUT_RSP:524524+ case ISCSI_OP_NOOP_IN:518525 case ISCSI_OP_SCSI_TMFUNC_RSP:519526 rc = iscsi_complete_pdu(conn, hdr, NULL, 0);520527 break;···546523 * skbs to complete the command then we have to copy the header547524 * for later use548525 */549549- if (tcp_conn->in.zero_copy_hdr && tcp_conn->in.copy <526526+ if (tcp_conn->in.zero_copy_hdr && tcp_conn->in.copy <=550527 (tcp_conn->in.datalen + tcp_conn->in.padding +551528 (conn->datadgst_en ? 4 : 0))) {552529 debug_tcp("Copying header for later use. in.copy %d in.datalen"···637614 * byte counters.638615 **/639616static inline int640640-iscsi_tcp_copy(struct iscsi_tcp_conn *tcp_conn)617617+iscsi_tcp_copy(struct iscsi_conn *conn)641618{642642- void *buf = tcp_conn->data;619619+ struct iscsi_tcp_conn *tcp_conn = conn->dd_data;643620 int buf_size = tcp_conn->in.datalen;644621 int buf_left = buf_size - tcp_conn->data_copied;645622 int size = min(tcp_conn->in.copy, buf_left);···650627 BUG_ON(size <= 0);651628652629 rc = skb_copy_bits(tcp_conn->in.skb, tcp_conn->in.offset,653653- (char*)buf + tcp_conn->data_copied, size);630630+ (char*)conn->data + tcp_conn->data_copied, size);654631 BUG_ON(rc);655632656633 tcp_conn->in.offset += size;···768745done:769746 /* check for non-exceptional status */770747 if (tcp_conn->in.hdr->flags & ISCSI_FLAG_DATA_STATUS) {771771- debug_scsi("done [sc %lx res %d itt 0x%x]\n",772772- (long)sc, sc->result, ctask->itt);748748+ debug_scsi("done [sc %lx res %d itt 0x%x flags 0x%x]\n",749749+ (long)sc, sc->result, ctask->itt,750750+ tcp_conn->in.hdr->flags);773751 spin_lock(&conn->session->lock);774774- __iscsi_ctask_cleanup(conn, ctask);752752+ iscsi_tcp_cleanup_ctask(conn, ctask);775753 __iscsi_complete_pdu(conn, tcp_conn->in.hdr, NULL, 0);776754 spin_unlock(&conn->session->lock);777755 }···793769 break;794770 case ISCSI_OP_SCSI_CMD_RSP:795771 spin_lock(&conn->session->lock);796796- __iscsi_ctask_cleanup(conn, tcp_conn->in.ctask);772772+ iscsi_tcp_cleanup_ctask(conn, tcp_conn->in.ctask);797773 spin_unlock(&conn->session->lock);798774 case ISCSI_OP_TEXT_RSP:799775 case ISCSI_OP_LOGIN_RSP:800800- case ISCSI_OP_NOOP_IN:801776 case ISCSI_OP_ASYNC_EVENT:802777 case ISCSI_OP_REJECT:803778 /*804779 * Collect data segment to the connection's data805780 * placeholder806781 */807807- if (iscsi_tcp_copy(tcp_conn)) {782782+ if (iscsi_tcp_copy(conn)) {808783 rc = -EAGAIN;809784 goto exit;810785 }811786812812- rc = iscsi_complete_pdu(conn, tcp_conn->in.hdr, tcp_conn->data,787787+ rc = iscsi_complete_pdu(conn, tcp_conn->in.hdr, conn->data,813788 tcp_conn->in.datalen);814789 if (!rc && conn->datadgst_en && opcode != ISCSI_OP_LOGIN_RSP)815815- iscsi_recv_digest_update(tcp_conn, tcp_conn->data,790790+ iscsi_recv_digest_update(tcp_conn, conn->data,816791 tcp_conn->in.datalen);817792 break;818793 default:···866843 if (rc == -EAGAIN)867844 goto nomore;868845 else {869869- iscsi_conn_failure(conn, rc);846846+ iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);870847 return 0;871848 }872849 }···920897 if (rc) {921898 if (rc == -EAGAIN)922899 goto again;923923- iscsi_conn_failure(conn, rc);900900+ iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);924901 return 0;925902 }926903 tcp_conn->in.copy -= tcp_conn->in.padding;···10511028}1052102910531030static void10541054-iscsi_conn_restore_callbacks(struct iscsi_conn *conn)10311031+iscsi_conn_restore_callbacks(struct iscsi_tcp_conn *tcp_conn)10551032{10561056- struct iscsi_tcp_conn *tcp_conn = conn->dd_data;10571033 struct sock *sk = tcp_conn->sock->sk;1058103410591035 /* restore socket callbacks, see also: iscsi_conn_set_callbacks() */···13301308 ctask->imm_count -13311309 ctask->unsol_count;1332131013331333- debug_scsi("cmd [itt %x total %d imm %d imm_data %d "13111311+ debug_scsi("cmd [itt 0x%x total %d imm %d imm_data %d "13341312 "r2t_data %d]\n",13351313 ctask->itt, ctask->total_length, ctask->imm_count,13361314 ctask->unsol_count, tcp_ctask->r2t_data_count);···16581636 }16591637solicit_again:16601638 /*16611661- * send Data-Out whitnin this R2T sequence.16391639+ * send Data-Out within this R2T sequence.16621640 */16631641 if (!r2t->data_count)16641642 goto data_out_done;···17531731 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;17541732 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;17551733 struct iscsi_data_task *dtask = tcp_ctask->dtask;17561756- int sent, rc;17341734+ int sent = 0, rc;1757173517581736 tcp_ctask->xmstate &= ~XMSTATE_W_PAD;17591737 iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad,···19221900 tcp_conn->in_progress = IN_PROGRESS_WAIT_HEADER;19231901 /* initial operational parameters */19241902 tcp_conn->hdr_size = sizeof(struct iscsi_hdr);19251925- tcp_conn->data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH;19261926-19271927- /* allocate initial PDU receive place holder */19281928- if (tcp_conn->data_size <= PAGE_SIZE)19291929- tcp_conn->data = kmalloc(tcp_conn->data_size, GFP_KERNEL);19301930- else19311931- tcp_conn->data = (void*)__get_free_pages(GFP_KERNEL,19321932- get_order(tcp_conn->data_size));19331933- if (!tcp_conn->data)19341934- goto max_recv_dlenght_alloc_fail;1935190319361904 return cls_conn;1937190519381938-max_recv_dlenght_alloc_fail:19391939- kfree(tcp_conn);19401906tcp_conn_alloc_fail:19411907 iscsi_conn_teardown(cls_conn);19421908 return NULL;19091909+}19101910+19111911+static void19121912+iscsi_tcp_release_conn(struct iscsi_conn *conn)19131913+{19141914+ struct iscsi_tcp_conn *tcp_conn = conn->dd_data;19151915+19161916+ if (!tcp_conn->sock)19171917+ return;19181918+19191919+ sock_hold(tcp_conn->sock->sk);19201920+ iscsi_conn_restore_callbacks(tcp_conn);19211921+ sock_put(tcp_conn->sock->sk);19221922+19231923+ sock_release(tcp_conn->sock);19241924+ tcp_conn->sock = NULL;19251925+ conn->recv_lock = NULL;19431926}1944192719451928static void···19571930 if (conn->hdrdgst_en || conn->datadgst_en)19581931 digest = 1;1959193219331933+ iscsi_tcp_release_conn(conn);19601934 iscsi_conn_teardown(cls_conn);1961193519621936 /* now free tcp_conn */···19721944 crypto_free_tfm(tcp_conn->data_rx_tfm);19731945 }1974194619751975- /* free conn->data, size = MaxRecvDataSegmentLength */19761976- if (tcp_conn->data_size <= PAGE_SIZE)19771977- kfree(tcp_conn->data);19781978- else19791979- free_pages((unsigned long)tcp_conn->data,19801980- get_order(tcp_conn->data_size));19811947 kfree(tcp_conn);19481948+}19491949+19501950+static void19511951+iscsi_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)19521952+{19531953+ struct iscsi_conn *conn = cls_conn->dd_data;19541954+19551955+ iscsi_conn_stop(cls_conn, flag);19561956+ iscsi_tcp_release_conn(conn);19821957}1983195819841959static int···20322001 return 0;20332002}2034200320352035-static void20362036-iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)20372037-{20382038- struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;20392039- struct iscsi_r2t_info *r2t;20402040-20412041- /* flush ctask's r2t queues */20422042- while (__kfifo_get(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)))20432043- __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t,20442044- sizeof(void*));20452045-20462046- __iscsi_ctask_cleanup(conn, ctask);20472047-}20482048-20492049-static void20502050-iscsi_tcp_suspend_conn_rx(struct iscsi_conn *conn)20512051-{20522052- struct iscsi_tcp_conn *tcp_conn = conn->dd_data;20532053- struct sock *sk;20542054-20552055- if (!tcp_conn->sock)20562056- return;20572057-20582058- sk = tcp_conn->sock->sk;20592059- write_lock_bh(&sk->sk_callback_lock);20602060- set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);20612061- write_unlock_bh(&sk->sk_callback_lock);20622062-}20632063-20642064-static void20652065-iscsi_tcp_terminate_conn(struct iscsi_conn *conn)20662066-{20672067- struct iscsi_tcp_conn *tcp_conn = conn->dd_data;20682068-20692069- if (!tcp_conn->sock)20702070- return;20712071-20722072- sock_hold(tcp_conn->sock->sk);20732073- iscsi_conn_restore_callbacks(conn);20742074- sock_put(tcp_conn->sock->sk);20752075-20762076- sock_release(tcp_conn->sock);20772077- tcp_conn->sock = NULL;20782078- conn->recv_lock = NULL;20792079-}20802080-20812004/* called with host lock */20822005static void20832006iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask,···20422057 iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr,20432058 sizeof(struct iscsi_hdr));20442059 tcp_mtask->xmstate = XMSTATE_IMM_HDR;20602060+ tcp_mtask->sent = 0;2045206120462062 if (mtask->data_count)20472063 iscsi_buf_init_iov(&tcp_mtask->sendbuf, (char*)mtask->data,···21242138 int value;2125213921262140 switch(param) {21272127- case ISCSI_PARAM_MAX_RECV_DLENGTH: {21282128- char *saveptr = tcp_conn->data;21292129- gfp_t flags = GFP_KERNEL;21302130-21312131- sscanf(buf, "%d", &value);21322132- if (tcp_conn->data_size >= value) {21332133- iscsi_set_param(cls_conn, param, buf, buflen);21342134- break;21352135- }21362136-21372137- spin_lock_bh(&session->lock);21382138- if (conn->stop_stage == STOP_CONN_RECOVER)21392139- flags = GFP_ATOMIC;21402140- spin_unlock_bh(&session->lock);21412141-21422142- if (value <= PAGE_SIZE)21432143- tcp_conn->data = kmalloc(value, flags);21442144- else21452145- tcp_conn->data = (void*)__get_free_pages(flags,21462146- get_order(value));21472147- if (tcp_conn->data == NULL) {21482148- tcp_conn->data = saveptr;21492149- return -ENOMEM;21502150- }21512151- if (tcp_conn->data_size <= PAGE_SIZE)21522152- kfree(saveptr);21532153- else21542154- free_pages((unsigned long)saveptr,21552155- get_order(tcp_conn->data_size));21562156- iscsi_set_param(cls_conn, param, buf, buflen);21572157- tcp_conn->data_size = value;21582158- break;21592159- }21602141 case ISCSI_PARAM_HDRDGST_EN:21612142 iscsi_set_param(cls_conn, param, buf, buflen);21622143 tcp_conn->hdr_size = sizeof(struct iscsi_hdr);···23142361}2315236223162363static struct scsi_host_template iscsi_sht = {23172317- .name = "iSCSI Initiator over TCP/IP, v"23182318- ISCSI_TCP_VERSION,23642364+ .name = "iSCSI Initiator over TCP/IP",23192365 .queuecommand = iscsi_queuecommand,23202366 .change_queue_depth = iscsi_change_queue_depth,23212367 .can_queue = ISCSI_XMIT_CMDS_MAX - 1,···23662414 .get_conn_param = iscsi_tcp_conn_get_param,23672415 .get_session_param = iscsi_session_get_param,23682416 .start_conn = iscsi_conn_start,23692369- .stop_conn = iscsi_conn_stop,23702370- /* these are called as part of conn recovery */23712371- .suspend_conn_recv = iscsi_tcp_suspend_conn_rx,23722372- .terminate_conn = iscsi_tcp_terminate_conn,24172417+ .stop_conn = iscsi_tcp_conn_stop,23732418 /* IO */23742419 .send_pdu = iscsi_conn_send_pdu,23752420 .get_stats = iscsi_conn_get_stats,
-2
drivers/scsi/iscsi_tcp.h
···7878 char hdrext[4*sizeof(__u16) +7979 sizeof(__u32)];8080 int data_copied;8181- char *data; /* data placeholder */8282- int data_size; /* actual recv_dlength */8381 int stop_stage; /* conn_stop() flag: *8482 * stop to recover, *8583 * stop to terminate */
+116-98
drivers/scsi/libiscsi.c
···189189{190190 struct scsi_cmnd *sc = ctask->sc;191191192192+ ctask->state = ISCSI_TASK_COMPLETED;192193 ctask->sc = NULL;193194 list_del_init(&ctask->running);194195 __kfifo_put(session->cmdpool.queue, (void*)&ctask, sizeof(void*));···276275 return rc;277276}278277278278+static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)279279+{280280+ struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr;281281+282282+ conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;283283+ conn->tmfrsp_pdus_cnt++;284284+285285+ if (conn->tmabort_state != TMABORT_INITIAL)286286+ return;287287+288288+ if (tmf->response == ISCSI_TMF_RSP_COMPLETE)289289+ conn->tmabort_state = TMABORT_SUCCESS;290290+ else if (tmf->response == ISCSI_TMF_RSP_NO_TASK)291291+ conn->tmabort_state = TMABORT_NOT_FOUND;292292+ else293293+ conn->tmabort_state = TMABORT_FAILED;294294+ wake_up(&conn->ehwait);295295+}296296+279297/**280298 * __iscsi_complete_pdu - complete pdu281299 * @conn: iscsi conn···360340361341 switch(opcode) {362342 case ISCSI_OP_LOGOUT_RSP:343343+ if (datalen) {344344+ rc = ISCSI_ERR_PROTO;345345+ break;346346+ }363347 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;364348 /* fall through */365349 case ISCSI_OP_LOGIN_RSP:···372348 * login related PDU's exp_statsn is handled in373349 * userspace374350 */375375- rc = iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen);351351+ if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen))352352+ rc = ISCSI_ERR_CONN_FAILED;376353 list_del(&mtask->running);377354 if (conn->login_mtask != mtask)378355 __kfifo_put(session->mgmtpool.queue,···385360 break;386361 }387362388388- conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;389389- conn->tmfrsp_pdus_cnt++;390390- if (conn->tmabort_state == TMABORT_INITIAL) {391391- conn->tmabort_state =392392- ((struct iscsi_tm_rsp *)hdr)->393393- response == ISCSI_TMF_RSP_COMPLETE ?394394- TMABORT_SUCCESS:TMABORT_FAILED;395395- /* unblock eh_abort() */396396- wake_up(&conn->ehwait);397397- }363363+ iscsi_tmf_rsp(conn, hdr);398364 break;399365 case ISCSI_OP_NOOP_IN:400400- if (hdr->ttt != ISCSI_RESERVED_TAG) {366366+ if (hdr->ttt != ISCSI_RESERVED_TAG || datalen) {401367 rc = ISCSI_ERR_PROTO;402368 break;403369 }404370 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;405371406406- rc = iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen);372372+ if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen))373373+ rc = ISCSI_ERR_CONN_FAILED;407374 list_del(&mtask->running);408375 if (conn->login_mtask != mtask)409376 __kfifo_put(session->mgmtpool.queue,···408391 } else if (itt == ISCSI_RESERVED_TAG) {409392 switch(opcode) {410393 case ISCSI_OP_NOOP_IN:411411- if (!datalen) {412412- rc = iscsi_check_assign_cmdsn(session,413413- (struct iscsi_nopin*)hdr);414414- if (!rc && hdr->ttt != ISCSI_RESERVED_TAG)415415- rc = iscsi_recv_pdu(conn->cls_conn,416416- hdr, NULL, 0);417417- } else394394+ if (datalen) {418395 rc = ISCSI_ERR_PROTO;396396+ break;397397+ }398398+399399+ rc = iscsi_check_assign_cmdsn(session,400400+ (struct iscsi_nopin*)hdr);401401+ if (rc)402402+ break;403403+404404+ if (hdr->ttt == ISCSI_RESERVED_TAG)405405+ break;406406+407407+ if (iscsi_recv_pdu(conn->cls_conn, hdr, NULL, 0))408408+ rc = ISCSI_ERR_CONN_FAILED;419409 break;420410 case ISCSI_OP_REJECT:421411 /* we need sth like iscsi_reject_rsp()*/···592568 }593569594570 /* process command queue */595595- while (__kfifo_get(conn->xmitqueue, (void*)&conn->ctask,596596- sizeof(void*))) {571571+ spin_lock_bh(&conn->session->lock);572572+ while (!list_empty(&conn->xmitqueue)) {597573 /*598574 * iscsi tcp may readd the task to the xmitqueue to send599575 * write data600576 */601601- spin_lock_bh(&conn->session->lock);602602- if (list_empty(&conn->ctask->running))603603- list_add_tail(&conn->ctask->running, &conn->run_list);577577+ conn->ctask = list_entry(conn->xmitqueue.next,578578+ struct iscsi_cmd_task, running);579579+ conn->ctask->state = ISCSI_TASK_RUNNING;580580+ list_move_tail(conn->xmitqueue.next, &conn->run_list);604581 spin_unlock_bh(&conn->session->lock);582582+605583 rc = tt->xmit_cmd_task(conn, conn->ctask);606584 if (rc)607585 goto again;586586+ spin_lock_bh(&conn->session->lock);608587 }588588+ spin_unlock_bh(&conn->session->lock);609589 /* done with this ctask */610590 conn->ctask = NULL;611591···719691 sc->SCp.phase = session->age;720692 sc->SCp.ptr = (char *)ctask;721693694694+ ctask->state = ISCSI_TASK_PENDING;722695 ctask->mtask = NULL;723696 ctask->conn = conn;724697 ctask->sc = sc;···729700730701 session->tt->init_cmd_task(ctask);731702732732- __kfifo_put(conn->xmitqueue, (void*)&ctask, sizeof(void*));703703+ list_add_tail(&ctask->running, &conn->xmitqueue);733704 debug_scsi(734705 "ctask enq [%s cid %d sc %lx itt 0x%x len %d cmdsn %d win %d]\n",735706 sc->sc_data_direction == DMA_TO_DEVICE ? "write" : "read",···1006977/*1007978 * xmit mutex and session lock must be held1008979 */10091009-#define iscsi_remove_task(tasktype) \10101010-static struct iscsi_##tasktype * \10111011-iscsi_remove_##tasktype(struct kfifo *fifo, uint32_t itt) \10121012-{ \10131013- int i, nr_tasks = __kfifo_len(fifo) / sizeof(void*); \10141014- struct iscsi_##tasktype *task; \10151015- \10161016- debug_scsi("searching %d tasks\n", nr_tasks); \10171017- \10181018- for (i = 0; i < nr_tasks; i++) { \10191019- __kfifo_get(fifo, (void*)&task, sizeof(void*)); \10201020- debug_scsi("check task %u\n", task->itt); \10211021- \10221022- if (task->itt == itt) { \10231023- debug_scsi("matched task\n"); \10241024- return task; \10251025- } \10261026- \10271027- __kfifo_put(fifo, (void*)&task, sizeof(void*)); \10281028- } \10291029- return NULL; \10301030-}980980+static struct iscsi_mgmt_task *981981+iscsi_remove_mgmt_task(struct kfifo *fifo, uint32_t itt)982982+{983983+ int i, nr_tasks = __kfifo_len(fifo) / sizeof(void*);984984+ struct iscsi_mgmt_task *task;103198510321032-iscsi_remove_task(mgmt_task);10331033-iscsi_remove_task(cmd_task);986986+ debug_scsi("searching %d tasks\n", nr_tasks);987987+988988+ for (i = 0; i < nr_tasks; i++) {989989+ __kfifo_get(fifo, (void*)&task, sizeof(void*));990990+ debug_scsi("check task %u\n", task->itt);991991+992992+ if (task->itt == itt) {993993+ debug_scsi("matched task\n");994994+ return task;995995+ }996996+997997+ __kfifo_put(fifo, (void*)&task, sizeof(void*));998998+ }999999+ return NULL;10001000+}1034100110351002static int iscsi_ctask_mtask_cleanup(struct iscsi_cmd_task *ctask)10361003{···10521027{10531028 struct scsi_cmnd *sc;1054102910551055- conn->session->tt->cleanup_cmd_task(conn, ctask);10561056- iscsi_ctask_mtask_cleanup(ctask);10571057-10581030 sc = ctask->sc;10591031 if (!sc)10601032 return;10331033+10341034+ conn->session->tt->cleanup_cmd_task(conn, ctask);10351035+ iscsi_ctask_mtask_cleanup(ctask);10361036+10611037 sc->result = err;10621038 sc->resid = sc->request_bufflen;10631039 iscsi_complete_command(conn->session, ctask);···10691043 struct iscsi_cmd_task *ctask = (struct iscsi_cmd_task *)sc->SCp.ptr;10701044 struct iscsi_conn *conn = ctask->conn;10711045 struct iscsi_session *session = conn->session;10721072- struct iscsi_cmd_task *pending_ctask;10731046 int rc;1074104710751048 conn->eh_abort_cnt++;···10861061 goto failed;1087106210881063 /* ctask completed before time out */10891089- if (!ctask->sc)10901090- goto success;10641064+ if (!ctask->sc) {10651065+ spin_unlock_bh(&session->lock);10661066+ debug_scsi("sc completed while abort in progress\n");10671067+ goto success_rel_mutex;10681068+ }1091106910921070 /* what should we do here ? */10931071 if (conn->ctask == ctask) {···10991071 goto failed;11001072 }1101107311021102- /* check for the easy pending cmd abort */11031103- pending_ctask = iscsi_remove_cmd_task(conn->xmitqueue, ctask->itt);11041104- if (pending_ctask) {11051105- /* iscsi_tcp queues write transfers on the xmitqueue */11061106- if (list_empty(&pending_ctask->running)) {11071107- debug_scsi("found pending task\n");11081108- goto success;11091109- } else11101110- __kfifo_put(conn->xmitqueue, (void*)&pending_ctask,11111111- sizeof(void*));11121112- }10741074+ if (ctask->state == ISCSI_TASK_PENDING)10751075+ goto success_cleanup;1113107611141077 conn->tmabort_state = TMABORT_INITIAL;11151078···11081089 rc = iscsi_exec_abort_task(sc, ctask);11091090 spin_lock_bh(&session->lock);1110109111111111- iscsi_ctask_mtask_cleanup(ctask);11121092 if (rc || sc->SCp.phase != session->age ||11131093 session->state != ISCSI_STATE_LOGGED_IN)11141094 goto failed;10951095+ iscsi_ctask_mtask_cleanup(ctask);1115109611161116- /* ctask completed before tmf abort response */11171117- if (!ctask->sc) {11181118- debug_scsi("sc completed while abort in progress\n");11191119- goto success;11201120- }11211121-11221122- if (conn->tmabort_state != TMABORT_SUCCESS) {10971097+ switch (conn->tmabort_state) {10981098+ case TMABORT_SUCCESS:10991099+ goto success_cleanup;11001100+ case TMABORT_NOT_FOUND:11011101+ if (!ctask->sc) {11021102+ /* ctask completed before tmf abort response */11031103+ spin_unlock_bh(&session->lock);11041104+ debug_scsi("sc completed while abort in progress\n");11051105+ goto success_rel_mutex;11061106+ }11071107+ /* fall through */11081108+ default:11091109+ /* timedout or failed */11231110 spin_unlock_bh(&session->lock);11241111 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);11251112 spin_lock_bh(&session->lock);11261113 goto failed;11271114 }1128111511291129-success:11161116+success_cleanup:11301117 debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);11311118 spin_unlock_bh(&session->lock);11321119···11461121 spin_unlock(&session->lock);11471122 write_unlock_bh(conn->recv_lock);1148112311241124+success_rel_mutex:11491125 mutex_unlock(&conn->xmitmutex);11501126 return SUCCESS;11511127···12891263 if (cmd_task_size)12901264 ctask->dd_data = &ctask[1];12911265 ctask->itt = cmd_i;12661266+ INIT_LIST_HEAD(&ctask->running);12921267 }1293126812941269 spin_lock_init(&session->lock);···13091282 if (mgmt_task_size)13101283 mtask->dd_data = &mtask[1];13111284 mtask->itt = ISCSI_MGMT_ITT_OFFSET + cmd_i;12851285+ INIT_LIST_HEAD(&mtask->running);13121286 }1313128713141288 if (scsi_add_host(shost, NULL))···13501322{13511323 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);13521324 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);13251325+ struct module *owner = cls_session->transport->owner;1353132613541327 scsi_remove_host(shost);1355132813561329 iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds);13571330 iscsi_pool_free(&session->cmdpool, (void**)session->cmds);1358133113321332+ kfree(session->targetname);13331333+13591334 iscsi_destroy_session(cls_session);13601335 scsi_host_put(shost);13611361- module_put(cls_session->transport->owner);13361336+ module_put(owner);13621337}13631338EXPORT_SYMBOL_GPL(iscsi_session_teardown);13641339···13921361 conn->tmabort_state = TMABORT_INITIAL;13931362 INIT_LIST_HEAD(&conn->run_list);13941363 INIT_LIST_HEAD(&conn->mgmt_run_list);13951395-13961396- /* initialize general xmit PDU commands queue */13971397- conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*),13981398- GFP_KERNEL, NULL);13991399- if (conn->xmitqueue == ERR_PTR(-ENOMEM))14001400- goto xmitqueue_alloc_fail;13641364+ INIT_LIST_HEAD(&conn->xmitqueue);1401136514021366 /* initialize general immediate & non-immediate PDU commands queue */14031367 conn->immqueue = kfifo_alloc(session->mgmtpool_max * sizeof(void*),···14201394 data = kmalloc(DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, GFP_KERNEL);14211395 if (!data)14221396 goto login_mtask_data_alloc_fail;14231423- conn->login_mtask->data = data;13971397+ conn->login_mtask->data = conn->data = data;1424139814251399 init_timer(&conn->tmabort_timer);14261400 mutex_init(&conn->xmitmutex);···14361410mgmtqueue_alloc_fail:14371411 kfifo_free(conn->immqueue);14381412immqueue_alloc_fail:14391439- kfifo_free(conn->xmitqueue);14401440-xmitqueue_alloc_fail:14411413 iscsi_destroy_conn(cls_conn);14421414 return NULL;14431415}···1456143214571433 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);14581434 mutex_lock(&conn->xmitmutex);14591459- if (conn->c_stage == ISCSI_CONN_INITIAL_STAGE) {14601460- if (session->tt->suspend_conn_recv)14611461- session->tt->suspend_conn_recv(conn);14621462-14631463- session->tt->terminate_conn(conn);14641464- }1465143514661436 spin_lock_bh(&session->lock);14671437 conn->c_stage = ISCSI_CONN_CLEANUP_WAIT;···14921474 }1493147514941476 spin_lock_bh(&session->lock);14951495- kfree(conn->login_mtask->data);14771477+ kfree(conn->data);14781478+ kfree(conn->persistent_address);14961479 __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask,14971480 sizeof(void*));14981481 list_del(&conn->item);···15081489 session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1;15091490 spin_unlock_bh(&session->lock);1510149115111511- kfifo_free(conn->xmitqueue);15121492 kfifo_free(conn->immqueue);15131493 kfifo_free(conn->mgmtqueue);15141494···15901572 struct iscsi_cmd_task *ctask, *tmp;1591157315921574 /* flush pending */15931593- while (__kfifo_get(conn->xmitqueue, (void*)&ctask, sizeof(void*))) {15751575+ list_for_each_entry_safe(ctask, tmp, &conn->xmitqueue, running) {15941576 debug_scsi("failing pending sc %p itt 0x%x\n", ctask->sc,15951577 ctask->itt);15961578 fail_command(conn, ctask, DID_BUS_BUSY << 16);···16331615 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);16341616 spin_unlock_bh(&session->lock);1635161716361636- if (session->tt->suspend_conn_recv)16371637- session->tt->suspend_conn_recv(conn);16181618+ write_lock_bh(conn->recv_lock);16191619+ set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);16201620+ write_unlock_bh(conn->recv_lock);1638162116391622 mutex_lock(&conn->xmitmutex);16401623 /*···16541635 }16551636 }1656163716571657- session->tt->terminate_conn(conn);16581638 /*16591639 * flush queues.16601640 */
···13791379 /* stop all timers associated with this hba */13801380 lpfc_stop_timer(phba);13811381 phba->work_hba_events = 0;13821382+ phba->work_ha = 0;1382138313831384 lpfc_printf_log(phba,13841385 KERN_WARNING,···16171616 goto out_free_iocbq;16181617 }1619161816201620- /* We can rely on a queue depth attribute only after SLI HBA setup */16191619+ /*16201620+ * Set initial can_queue value since 0 is no longer supported and16211621+ * scsi_add_host will fail. This will be adjusted later based on the16221622+ * max xri value determined in hba setup.16231623+ */16211624 host->can_queue = phba->cfg_hba_queue_depth - 10;1622162516231626 /* Tell the midlayer we support 16 byte commands */···16601655 error = -ENODEV;16611656 goto out_free_irq;16621657 }16581658+16591659+ /*16601660+ * hba setup may have changed the hba_queue_depth so we need to adjust16611661+ * the value of can_queue.16621662+ */16631663+ host->can_queue = phba->cfg_hba_queue_depth - 10;1663166416641665 lpfc_discovery_wait(phba);16651666
+16
drivers/scsi/lpfc/lpfc_mbox.c
···651651652652 return mbq;653653}654654+655655+int656656+lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)657657+{658658+ switch (cmd) {659659+ case MBX_WRITE_NV: /* 0x03 */660660+ case MBX_UPDATE_CFG: /* 0x1B */661661+ case MBX_DOWN_LOAD: /* 0x1C */662662+ case MBX_DEL_LD_ENTRY: /* 0x1D */663663+ case MBX_LOAD_AREA: /* 0x81 */664664+ case MBX_FLASH_WR_ULA: /* 0x98 */665665+ case MBX_LOAD_EXP_ROM: /* 0x9C */666666+ return LPFC_MBOX_TMO_FLASH_CMD;667667+ }668668+ return LPFC_MBOX_TMO;669669+}
+22-2
drivers/scsi/lpfc/lpfc_nportdisc.c
···179179180180 /* Abort outstanding I/O on NPort <nlp_DID> */181181 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,182182- "%d:0201 Abort outstanding I/O on NPort x%x "182182+ "%d:0205 Abort outstanding I/O on NPort x%x "183183 "Data: x%x x%x x%x\n",184184 phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag,185185 ndlp->nlp_state, ndlp->nlp_rpi);···392392 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;393393 mbox->context2 = ndlp;394394 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI);395395+396396+ /*397397+ * If there is an outstanding PLOGI issued, abort it before398398+ * sending ACC rsp for received PLOGI. If pending plogi399399+ * is not canceled here, the plogi will be rejected by400400+ * remote port and will be retried. On a configuration with401401+ * single discovery thread, this will cause a huge delay in402402+ * discovery. Also this will cause multiple state machines403403+ * running in parallel for this node.404404+ */405405+ if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) {406406+ /* software abort outstanding PLOGI */407407+ lpfc_els_abort(phba, ndlp, 1);408408+ }395409396410 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);397411 return 1;···1615160116161602 lpfc_rcv_padisc(phba, ndlp, cmdiocb);1617160316181618- if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {16041604+ /*16051605+ * Do not start discovery if discovery is about to start16061606+ * or discovery in progress for this node. Starting discovery16071607+ * here will affect the counting of discovery threads.16081608+ */16091609+ if ((!(ndlp->nlp_flag & NLP_DELAY_TMO)) &&16101610+ (ndlp->nlp_flag & NLP_NPR_2B_DISC)){16191611 if (ndlp->nlp_flag & NLP_NPR_ADISC) {16201612 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;16211613 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
+20-1
drivers/scsi/lpfc/lpfc_scsi.c
···21212222#include <linux/pci.h>2323#include <linux/interrupt.h>2424+#include <linux/delay.h>24252526#include <scsi/scsi.h>2627#include <scsi/scsi_device.h>···842841 return 0;843842}844843844844+static void845845+lpfc_block_error_handler(struct scsi_cmnd *cmnd)846846+{847847+ struct Scsi_Host *shost = cmnd->device->host;848848+ struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));849849+850850+ spin_lock_irq(shost->host_lock);851851+ while (rport->port_state == FC_PORTSTATE_BLOCKED) {852852+ spin_unlock_irq(shost->host_lock);853853+ msleep(1000);854854+ spin_lock_irq(shost->host_lock);855855+ }856856+ spin_unlock_irq(shost->host_lock);857857+ return;858858+}845859846860static int847861lpfc_abort_handler(struct scsi_cmnd *cmnd)···871855 unsigned int loop_count = 0;872856 int ret = SUCCESS;873857858858+ lpfc_block_error_handler(cmnd);874859 spin_lock_irq(shost->host_lock);875860876861 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble;···974957 int ret = FAILED;975958 int cnt, loopcnt;976959960960+ lpfc_block_error_handler(cmnd);977961 spin_lock_irq(shost->host_lock);978962 /*979963 * If target is not in a MAPPED state, delay the reset until···10911073 int cnt, loopcnt;10921074 struct lpfc_scsi_buf * lpfc_cmd;1093107510761076+ lpfc_block_error_handler(cmnd);10941077 spin_lock_irq(shost->host_lock);1095107810961079 lpfc_cmd = lpfc_get_scsi_buf(phba);···11231104 ndlp->rport->dd_data);11241105 if (ret != SUCCESS) {11251106 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,11261126- "%d:0713 Bus Reset on target %d failed\n",11071107+ "%d:0700 Bus Reset on target %d failed\n",11271108 phba->brd_no, i);11281109 err_count++;11291110 }
+36-21
drivers/scsi/lpfc/lpfc_sli.c
···320320 kfree(old_arr);321321 return iotag;322322 }323323- }323323+ } else324324+ spin_unlock_irq(phba->host->host_lock);324325325326 lpfc_printf_log(phba, KERN_ERR,LOG_SLI,326327 "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n",···970969 * resources need to be recovered.971970 */972971 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {973973- printk(KERN_INFO "%s: IOCB cmd 0x%x processed."974974- " Skipping completion\n", __FUNCTION__,975975- irsp->ulpCommand);972972+ lpfc_printf_log(phba, KERN_INFO, LOG_SLI,973973+ "%d:0314 IOCB cmd 0x%x"974974+ " processed. Skipping"975975+ " completion", phba->brd_no,976976+ irsp->ulpCommand);976977 break;977978 }978979···11071104 if (unlikely(irsp->ulpStatus)) {11081105 /* Rsp ring <ringno> error: IOCB */11091106 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,11101110- "%d:0326 Rsp Ring %d error: IOCB Data: "11071107+ "%d:0336 Rsp Ring %d error: IOCB Data: "11111108 "x%x x%x x%x x%x x%x x%x x%x x%x\n",11121109 phba->brd_no, pring->ringno,11131110 irsp->un.ulpWord[0], irsp->un.ulpWord[1],···11251122 * resources need to be recovered.11261123 */11271124 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {11281128- printk(KERN_INFO "%s: IOCB cmd 0x%x processed. "11291129- "Skipping completion\n", __FUNCTION__,11301130- irsp->ulpCommand);11251125+ lpfc_printf_log(phba, KERN_INFO, LOG_SLI,11261126+ "%d:0333 IOCB cmd 0x%x"11271127+ " processed. Skipping"11281128+ " completion\n", phba->brd_no,11291129+ irsp->ulpCommand);11311130 break;11321131 }11331132···11601155 } else {11611156 /* Unknown IOCB command */11621157 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,11631163- "%d:0321 Unknown IOCB command "11581158+ "%d:0334 Unknown IOCB command "11641159 "Data: x%x, x%x x%x x%x x%x\n",11651160 phba->brd_no, type, irsp->ulpCommand,11661161 irsp->ulpStatus, irsp->ulpIoTag,···12431238 lpfc_printf_log(phba,12441239 KERN_ERR,12451240 LOG_SLI,12461246- "%d:0312 Ring %d handler: portRspPut %d "12411241+ "%d:0303 Ring %d handler: portRspPut %d "12471242 "is bigger then rsp ring %d\n",12481243 phba->brd_no,12491244 pring->ringno, portRspPut, portRspMax);···13881383 lpfc_printf_log(phba,13891384 KERN_ERR,13901385 LOG_SLI,13911391- "%d:0321 Unknown IOCB command "13861386+ "%d:0335 Unknown IOCB command "13921387 "Data: x%x x%x x%x x%x\n",13931388 phba->brd_no,13941389 irsp->ulpCommand,···14041399 next_iocb,14051400 &saveq->list,14061401 list) {14021402+ list_del(&rspiocbp->list);14071403 lpfc_sli_release_iocbq(phba,14081404 rspiocbp);14091405 }14101406 }14111411-14121407 lpfc_sli_release_iocbq(phba, saveq);14131408 }14141409 }···17161711 phba->fc_myDID = 0;17171712 phba->fc_prevDID = 0;1718171317191719- psli->sli_flag = 0;17201720-17211714 /* Turn off parity checking and serr during the physical reset */17221715 pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value);17231716 pci_write_config_word(phba->pcidev, PCI_COMMAND,17241717 (cfg_value &17251718 ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));1726171917271727- psli->sli_flag &= ~LPFC_SLI2_ACTIVE;17201720+ psli->sli_flag &= ~(LPFC_SLI2_ACTIVE | LPFC_PROCESS_LA);17281721 /* Now toggle INITFF bit in the Host Control Register */17291722 writel(HC_INITFF, phba->HCregaddr);17301723 mdelay(1);···1763176017641761 /* Restart HBA */17651762 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,17661766- "%d:0328 Restart HBA Data: x%x x%x\n", phba->brd_no,17631763+ "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no,17671764 phba->hba_state, psli->sli_flag);1768176517691766 word0 = 0;···17941791 phba->hba_state = LPFC_INIT_START;1795179217961793 spin_unlock_irq(phba->host->host_lock);17941794+17951795+ memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets));17961796+ psli->stats_start = get_seconds();1797179717981798 if (skip_post)17991799 mdelay(100);···19081902 }1909190319101904 while (resetcount < 2 && !done) {19051905+ spin_lock_irq(phba->host->host_lock);19061906+ phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE;19071907+ spin_unlock_irq(phba->host->host_lock);19111908 phba->hba_state = LPFC_STATE_UNKNOWN;19121909 lpfc_sli_brdrestart(phba);19131910 msleep(2500);···19181909 if (rc)19191910 break;1920191119121912+ spin_lock_irq(phba->host->host_lock);19131913+ phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;19141914+ spin_unlock_irq(phba->host->host_lock);19211915 resetcount++;1922191619231917 /* Call pre CONFIG_PORT mailbox command initialization. A value of 0···22062194 return (MBX_NOT_FINISHED);22072195 }22082196 /* timeout active mbox command */22092209- mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO);21972197+ mod_timer(&psli->mbox_tmo, (jiffies +21982198+ (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand))));22102199 }2211220022122201 /* Mailbox cmd <cmd> issue */···22672254 break;2268225522692256 case MBX_POLL:22702270- i = 0;22712257 psli->mbox_active = NULL;22722258 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {22732259 /* First read mbox status word */···22802268 /* Read the HBA Host Attention Register */22812269 ha_copy = readl(phba->HAregaddr);2282227022712271+ i = lpfc_mbox_tmo_val(phba, mb->mbxCommand);22722272+ i *= 1000; /* Convert to ms */22732273+22832274 /* Wait for command to complete */22842275 while (((word0 & OWN_CHIP) == OWN_CHIP) ||22852276 (!(ha_copy & HA_MBATT) &&22862277 (phba->hba_state > LPFC_WARM_START))) {22872287- if (i++ >= 100) {22782278+ if (i-- <= 0) {22882279 psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;22892280 spin_unlock_irqrestore(phba->host->host_lock,22902281 drvr_flag);···2305229023062291 /* Can be in interrupt context, do not sleep */23072292 /* (or might be called with interrupts disabled) */23082308- mdelay(i);22932293+ mdelay(1);2309229423102295 spin_lock_irqsave(phba->host->host_lock, drvr_flag);23112296···3020300530213006 if (timeleft == 0) {30223007 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,30233023- "%d:0329 IOCB wait timeout error - no "30083008+ "%d:0338 IOCB wait timeout error - no "30243009 "wake response Data x%x\n",30253010 phba->brd_no, timeout);30263011 retval = IOCB_TIMEDOUT;
+20
drivers/scsi/lpfc/lpfc_sli.h
···172172 uint32_t mbox_busy; /* Mailbox cmd busy */173173};174174175175+/* Structure to store link status values when port stats are reset */176176+struct lpfc_lnk_stat {177177+ uint32_t link_failure_count;178178+ uint32_t loss_of_sync_count;179179+ uint32_t loss_of_signal_count;180180+ uint32_t prim_seq_protocol_err_count;181181+ uint32_t invalid_tx_word_count;182182+ uint32_t invalid_crc_count;183183+ uint32_t error_frames;184184+ uint32_t link_events;185185+};186186+175187/* Structure used to hold SLI information */176188struct lpfc_sli {177189 uint32_t num_rings;···213201 struct lpfc_iocbq ** iocbq_lookup; /* array to lookup IOCB by IOTAG */214202 size_t iocbq_lookup_len; /* current lengs of the array */215203 uint16_t last_iotag; /* last allocated IOTAG */204204+ unsigned long stats_start; /* in seconds */205205+ struct lpfc_lnk_stat lnk_stat_offsets;216206};217207218208/* Given a pointer to the start of the ring, and the slot number of···225211226212#define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox227213 command */214214+#define LPFC_MBOX_TMO_FLASH_CMD 300 /* Sec tmo for outstanding FLASH write215215+ * or erase cmds. This is especially216216+ * long because of the potential of217217+ * multiple flash erases that can be218218+ * spawned.219219+ */
+1-1
drivers/scsi/lpfc/lpfc_version.h
···1818 * included with this package. *1919 *******************************************************************/20202121-#define LPFC_DRIVER_VERSION "8.1.7"2121+#define LPFC_DRIVER_VERSION "8.1.9"22222323#define LPFC_DRIVER_NAME "lpfc"2424
···1010 * 2 of the License, or (at your option) any later version.1111 *1212 * FILE : megaraid_mbox.c1313- * Version : v2.20.4.8 (Apr 11 2006)1313+ * Version : v2.20.4.9 (Jul 16 2006)1414 *1515 * Authors:1616 * Atul Mukker <Atul.Mukker@lsil.com>···720720 struct pci_dev *pdev;721721 mraid_device_t *raid_dev;722722 int i;723723+ uint32_t magic64;723724724725725726 adapter->ito = MBOX_TIMEOUT;···864863865864 // Set the DMA mask to 64-bit. All supported controllers as capable of866865 // DMA in this range867867- if (pci_set_dma_mask(adapter->pdev, DMA_64BIT_MASK) != 0) {866866+ pci_read_config_dword(adapter->pdev, PCI_CONF_AMISIG64, &magic64);868867869869- con_log(CL_ANN, (KERN_WARNING870870- "megaraid: could not set DMA mask for 64-bit.\n"));868868+ if (((magic64 == HBA_SIGNATURE_64_BIT) &&869869+ ((adapter->pdev->subsystem_device !=870870+ PCI_SUBSYS_ID_MEGARAID_SATA_150_6) ||871871+ (adapter->pdev->subsystem_device !=872872+ PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) ||873873+ (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC &&874874+ adapter->pdev->device == PCI_DEVICE_ID_VERDE) ||875875+ (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC &&876876+ adapter->pdev->device == PCI_DEVICE_ID_DOBSON) ||877877+ (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC &&878878+ adapter->pdev->device == PCI_DEVICE_ID_LINDSAY) ||879879+ (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&880880+ adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) ||881881+ (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&882882+ adapter->pdev->device == PCI_DEVICE_ID_PERC4E_DI_KOBUK)) {883883+ if (pci_set_dma_mask(adapter->pdev, DMA_64BIT_MASK)) {884884+ con_log(CL_ANN, (KERN_WARNING885885+ "megaraid: DMA mask for 64-bit failed\n"));871886872872- goto out_free_sysfs_res;887887+ if (pci_set_dma_mask (adapter->pdev, DMA_32BIT_MASK)) {888888+ con_log(CL_ANN, (KERN_WARNING889889+ "megaraid: 32-bit DMA mask failed\n"));890890+ goto out_free_sysfs_res;891891+ }892892+ }873893 }874894875895 // setup tasklet for DPC···16421620 " [virtual] for logical drives\n"));1643162116441622 rdev->last_disp |= (1L << SCP2CHANNEL(scp));16231623+ }16241624+16251625+ if (scp->cmnd[1] & MEGA_SCSI_INQ_EVPD) {16261626+ scp->sense_buffer[0] = 0x70;16271627+ scp->sense_buffer[2] = ILLEGAL_REQUEST;16281628+ scp->sense_buffer[12] = MEGA_INVALID_FIELD_IN_CDB;16291629+ scp->result = CHECK_CONDITION << 1;16301630+ return NULL;16451631 }1646163216471633 /* Fall through */
+2-2
drivers/scsi/megaraid/megaraid_mbox.h
···2121#include "megaraid_ioctl.h"222223232424-#define MEGARAID_VERSION "2.20.4.8"2525-#define MEGARAID_EXT_VERSION "(Release Date: Mon Apr 11 12:27:22 EST 2006)"2424+#define MEGARAID_VERSION "2.20.4.9"2525+#define MEGARAID_EXT_VERSION "(Release Date: Sun Jul 16 12:27:22 EST 2006)"262627272828/*
+1-1
drivers/scsi/megaraid/megaraid_mm.c
···1010 * 2 of the License, or (at your option) any later version.1111 *1212 * FILE : megaraid_mm.c1313- * Version : v2.20.2.6 (Mar 7 2005)1313+ * Version : v2.20.2.7 (Jul 16 2006)1414 *1515 * Common management module1616 */
+2-2
drivers/scsi/megaraid/megaraid_mm.h
···2727#include "megaraid_ioctl.h"282829293030-#define LSI_COMMON_MOD_VERSION "2.20.2.6"3030+#define LSI_COMMON_MOD_VERSION "2.20.2.7"3131#define LSI_COMMON_MOD_EXT_VERSION \3232- "(Release Date: Mon Mar 7 00:01:03 EST 2005)"3232+ "(Release Date: Sun Jul 16 00:01:03 EST 2006)"333334343535#define LSI_DBGLVL dbglevel
···744744{745745 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);746746 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;747747- srb_t *sp;748747 int ret;749748 unsigned int id, lun;750749 unsigned long serial;···754755 lun = cmd->device->lun;755756 serial = cmd->serial_number;756757757757- sp = (srb_t *) CMD_SP(cmd);758758- if (!sp || !fcport)758758+ if (!fcport)759759 return ret;760760761761 qla_printk(KERN_INFO, ha,···873875{874876 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);875877 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;876876- srb_t *sp;877878 int ret;878879 unsigned int id, lun;879880 unsigned long serial;···883886 lun = cmd->device->lun;884887 serial = cmd->serial_number;885888886886- sp = (srb_t *) CMD_SP(cmd);887887- if (!sp || !fcport)889889+ if (!fcport)888890 return ret;889891890892 qla_printk(KERN_INFO, ha,···932936{933937 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);934938 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;935935- srb_t *sp;936939 int ret;937940 unsigned int id, lun;938941 unsigned long serial;···942947 lun = cmd->device->lun;943948 serial = cmd->serial_number;944949945945- sp = (srb_t *) CMD_SP(cmd);946946- if (!sp || !fcport)950950+ if (!fcport)947951 return ret;948952949953 qla_printk(KERN_INFO, ha,···2238224422392245 next_loopid = 0;22402246 list_for_each_entry(fcport, &ha->fcports, list) {22412241- if (fcport->port_type != FCT_TARGET)22422242- continue;22432243-22442247 /*22452248 * If the port is not ONLINE then try to login22462249 * to it if we haven't run out of retries.
···460460 * Return value:461461 * SUCCESS or FAILED or NEEDS_RETRY462462 **/463463-static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout, int copy_sense)463463+static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,464464+ int cmnd_size, int timeout, int copy_sense)464465{465466 struct scsi_device *sdev = scmd->device;466467 struct Scsi_Host *shost = sdev->host;···490489 old_data_direction = scmd->sc_data_direction;491490 old_cmd_len = scmd->cmd_len;492491 old_use_sg = scmd->use_sg;492492+493493+ memset(scmd->cmnd, 0, sizeof(scmd->cmnd));494494+ memcpy(scmd->cmnd, cmnd, cmnd_size);493495494496 if (copy_sense) {495497 int gfp_mask = GFP_ATOMIC;···614610 static unsigned char generic_sense[6] =615611 {REQUEST_SENSE, 0, 0, 0, 252, 0};616612617617- memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense));618618- return scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT, 1);613613+ return scsi_send_eh_cmnd(scmd, generic_sense, 6, SENSE_TIMEOUT, 1);619614}620615621616/**···739736 int retry_cnt = 1, rtn;740737741738retry_tur:742742- memcpy(scmd->cmnd, tur_command, sizeof(tur_command));743743-744744-745745- rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT, 0);739739+ rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, SENSE_TIMEOUT, 0);746740747741 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n",748742 __FUNCTION__, scmd, rtn));···839839 if (scmd->device->allow_restart) {840840 int rtn;841841842842- memcpy(scmd->cmnd, stu_command, sizeof(stu_command));843843- rtn = scsi_send_eh_cmnd(scmd, START_UNIT_TIMEOUT, 0);842842+ rtn = scsi_send_eh_cmnd(scmd, stu_command, 6,843843+ START_UNIT_TIMEOUT, 0);844844 if (rtn == SUCCESS)845845 return 0;846846 }
+10-5
drivers/scsi/scsi_transport_iscsi.c
···3434#define ISCSI_SESSION_ATTRS 113535#define ISCSI_CONN_ATTRS 113636#define ISCSI_HOST_ATTRS 03737+#define ISCSI_TRANSPORT_VERSION "1.1-646"37383839struct iscsi_internal {3940 int daemon_pid;···635634}636635637636static int638638-iscsi_broadcast_skb(struct mempool_zone *zone, struct sk_buff *skb)637637+iscsi_broadcast_skb(struct mempool_zone *zone, struct sk_buff *skb, gfp_t gfp)639638{640639 unsigned long flags;641640 int rc;642641643642 skb_get(skb);644644- rc = netlink_broadcast(nls, skb, 0, 1, GFP_KERNEL);643643+ rc = netlink_broadcast(nls, skb, 0, 1, gfp);645644 if (rc < 0) {646645 mempool_free(skb, zone->pool);647646 printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc);···750749 ev->r.connerror.cid = conn->cid;751750 ev->r.connerror.sid = iscsi_conn_get_sid(conn);752751753753- iscsi_broadcast_skb(conn->z_error, skb);752752+ iscsi_broadcast_skb(conn->z_error, skb, GFP_ATOMIC);754753755754 dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n",756755 error);···896895 * this will occur if the daemon is not up, so we just warn897896 * the user and when the daemon is restarted it will handle it898897 */899899- rc = iscsi_broadcast_skb(conn->z_pdu, skb);898898+ rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL);900899 if (rc < 0)901900 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "902901 "session destruction event. Check iscsi daemon\n");···959958 * this will occur if the daemon is not up, so we just warn960959 * the user and when the daemon is restarted it will handle it961960 */962962- rc = iscsi_broadcast_skb(conn->z_pdu, skb);961961+ rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL);963962 if (rc < 0)964963 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "965964 "session creation event. Check iscsi daemon\n");···16141613{16151614 int err;1616161516161616+ printk(KERN_INFO "Loading iSCSI transport class v%s.",16171617+ ISCSI_TRANSPORT_VERSION);16181618+16171619 err = class_register(&iscsi_transport_class);16181620 if (err)16191621 return err;···16821678 "Alex Aizman <itn780@yahoo.com>");16831679MODULE_DESCRIPTION("iSCSI Transport Interface");16841680MODULE_LICENSE("GPL");16811681+MODULE_VERSION(ISCSI_TRANSPORT_VERSION);
+4-4
drivers/scsi/sg.c
···1818 *1919 */20202121-static int sg_version_num = 30533; /* 2 digits for each component */2222-#define SG_VERSION_STR "3.5.33"2121+static int sg_version_num = 30534; /* 2 digits for each component */2222+#define SG_VERSION_STR "3.5.34"23232424/*2525 * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:···60606161#ifdef CONFIG_SCSI_PROC_FS6262#include <linux/proc_fs.h>6363-static char *sg_version_date = "20050908";6363+static char *sg_version_date = "20060818";64646565static int sg_proc_init(void);6666static void sg_proc_cleanup(void);···11641164 len = vma->vm_end - sa;11651165 len = (len < sg->length) ? len : sg->length;11661166 if (offset < len) {11671167- page = sg->page;11671167+ page = virt_to_page(page_address(sg->page) + offset);11681168 get_page(page); /* increment page count */11691169 break;11701170 }
···6060#define TMABORT_SUCCESS 0x16161#define TMABORT_FAILED 0x26262#define TMABORT_TIMEDOUT 0x36363+#define TMABORT_NOT_FOUND 0x463646465/* Connection suspend "bit" */6566#define ISCSI_SUSPEND_BIT 1···8483 struct list_head running;8584};86858686+enum {8787+ ISCSI_TASK_COMPLETED,8888+ ISCSI_TASK_PENDING,8989+ ISCSI_TASK_RUNNING,9090+};9191+8792struct iscsi_cmd_task {8893 /*8994 * Becuae LLDs allocate their hdr differently, this is a pointer to···108101 struct iscsi_conn *conn; /* used connection */109102 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */110103104104+ /* state set/tested under session->lock */105105+ int state;111106 struct list_head running; /* running cmd list */112107 void *dd_data; /* driver/transport data */113108};···135126 int id; /* CID */136127 struct list_head item; /* maintains list of conns */137128 int c_stage; /* connection state */129129+ /*130130+ * Preallocated buffer for pdus that have data but do not131131+ * originate from scsi-ml. We never have two pdus using the132132+ * buffer at the same time. It is only allocated to133133+ * the default max recv size because the pdus we support134134+ * should always fit in this buffer135135+ */136136+ char *data;138137 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */139138 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */140139 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */···151134 struct kfifo *immqueue; /* immediate xmit queue */152135 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */153136 struct list_head mgmt_run_list; /* list of control tasks */154154- struct kfifo *xmitqueue; /* data-path cmd queue */137137+ struct list_head xmitqueue; /* data-path cmd queue */155138 struct list_head run_list; /* list of cmds in progress */156139 struct work_struct xmitwork; /* per-conn. xmit workqueue */157140 /*
-4
include/scsi/scsi_transport_iscsi.h
···5757 * @stop_conn: suspend/recover/terminate connection5858 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.5959 * @session_recovery_timedout: notify LLD a block during recovery timed out6060- * @suspend_conn_recv: susepend the recv side of the connection6161- * @termincate_conn: destroy socket connection. Called with mutex lock.6260 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs.6361 * Called from queuecommand with session lock held.6462 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs.···110112 char *data, uint32_t data_size);111113 void (*get_stats) (struct iscsi_cls_conn *conn,112114 struct iscsi_stats *stats);113113- void (*suspend_conn_recv) (struct iscsi_conn *conn);114114- void (*terminate_conn) (struct iscsi_conn *conn);115115 void (*init_cmd_task) (struct iscsi_cmd_task *ctask);116116 void (*init_mgmt_task) (struct iscsi_conn *conn,117117 struct iscsi_mgmt_task *mtask,