From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
David Dillow <dave@thedillows.org>,
Roland Dreier <roland@purestorage.com>
Subject: [ 08/77] IB/srp: Avoid endless SCSI error handling loop
Date: Fri, 1 Mar 2013 11:43:53 -0800 [thread overview]
Message-ID: <20130301194352.853242357@linuxfoundation.org> (raw)
In-Reply-To: <20130301194351.913471337@linuxfoundation.org>
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <bvanassche@acm.org>
commit c7c4e7ff8047e43c45628b85ac200582e9404c39 upstream.
If a SCSI command times out it is passed to the SCSI error
handler. The SCSI error handler will try to abort the commands that
timed out. If aborting fails, a device reset will be attempted. If
the device reset also fails a host reset will be attempted. If the
host reset also fails the whole procedure will be repeated.
srp_abort() and srp_reset_device() fail for a QP in the error state.
srp_reset_host() fails after host removal has started. Hence if the
SCSI error handler gets invoked after host removal has started and
with the QP in the error state an endless loop will be triggered.
Modify the SCSI error handling functions in ib_srp as follows:
- Abort SCSI commands properly even if the QP is in the error state.
- Make srp_reset_host() reset SCSI requests even after host removal
has already started or if reconnecting fails.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: David Dillow <dave@thedillows.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/ulp/srp/ib_srp.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -700,23 +700,24 @@ static int srp_reconnect_target(struct s
struct Scsi_Host *shost = target->scsi_host;
int i, ret;
- if (target->state != SRP_TARGET_LIVE)
- return -EAGAIN;
-
scsi_target_block(&shost->shost_gendev);
srp_disconnect_target(target);
/*
- * Now get a new local CM ID so that we avoid confusing the
- * target in case things are really fouled up.
+ * Now get a new local CM ID so that we avoid confusing the target in
+ * case things are really fouled up. Doing so also ensures that all CM
+ * callbacks will have finished before a new QP is allocated.
*/
ret = srp_new_cm_id(target);
- if (ret)
- goto unblock;
-
- ret = srp_create_target_ib(target);
- if (ret)
- goto unblock;
+ /*
+ * Whether or not creating a new CM ID succeeded, create a new
+ * QP. This guarantees that all completion callback function
+ * invocations have finished before request resetting starts.
+ */
+ if (ret == 0)
+ ret = srp_create_target_ib(target);
+ else
+ srp_create_target_ib(target);
for (i = 0; i < SRP_CMD_SQ_SIZE; ++i) {
struct srp_request *req = &target->req_ring[i];
@@ -728,9 +729,9 @@ static int srp_reconnect_target(struct s
for (i = 0; i < SRP_SQ_SIZE; ++i)
list_add(&target->tx_ring[i]->list, &target->free_tx);
- ret = srp_connect_target(target);
+ if (ret == 0)
+ ret = srp_connect_target(target);
-unblock:
scsi_target_unblock(&shost->shost_gendev, ret == 0 ? SDEV_RUNNING :
SDEV_TRANSPORT_OFFLINE);
@@ -1739,7 +1740,7 @@ static int srp_abort(struct scsi_cmnd *s
shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
- if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd))
+ if (!req || !srp_claim_req(target, req, scmnd))
return FAILED;
srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
SRP_TSK_ABORT_TASK);
next prev parent reply other threads:[~2013-03-01 20:25 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 19:43 [ 00/77] 3.8.2-stable review Greg Kroah-Hartman
2013-03-01 19:43 ` [ 01/77] mm: do not grow the stack vma just because of an overrun on preceding vma Greg Kroah-Hartman
2013-03-01 19:43 ` [ 02/77] ALSA: bt87x: Make load_all parameter working again Greg Kroah-Hartman
2013-03-01 19:43 ` [ 03/77] ALSA: hda - hdmi: Make jacks phantom, if theyre not detectable Greg Kroah-Hartman
2013-03-01 19:43 ` [ 04/77] ALSA: emu10k1: Fix regression in emu1010 firmware loading Greg Kroah-Hartman
2013-03-01 19:43 ` [ 05/77] ALSA: emu10k1: Load firmware when it was already cached Greg Kroah-Hartman
2013-03-01 19:43 ` [ 06/77] IB/srp: Track connection state properly Greg Kroah-Hartman
2013-03-01 19:43 ` [ 07/77] IB/srp: Avoid sending a task management function needlessly Greg Kroah-Hartman
2013-03-01 19:43 ` Greg Kroah-Hartman [this message]
2013-03-01 19:43 ` [ 09/77] IB/srp: Fail I/O requests if the transport is offline Greg Kroah-Hartman
2013-03-01 19:43 ` [ 10/77] quota: autoload the quota_v2 module for QFMT_VFS_V1 quota format Greg Kroah-Hartman
2013-03-01 19:43 ` [ 11/77] usb: dwc3: Enable usb2 LPM only when connected as usb2.0 Greg Kroah-Hartman
2013-03-01 19:43 ` [ 12/77] usb: dwc3: gadget: fix missed isoc Greg Kroah-Hartman
2013-03-01 19:43 ` [ 13/77] usb: dwc3: gadget: fix isoc END TRANSFER Condition Greg Kroah-Hartman
2013-03-01 19:43 ` [ 14/77] usb: dwc3: gadget: fix skip LINK_TRB on ISOC Greg Kroah-Hartman
2013-03-01 19:44 ` [ 15/77] usb: dwc3: gadget: change HIRD threshold to 12 Greg Kroah-Hartman
2013-03-01 19:44 ` [ 16/77] b43: Fix lockdep splat on module unload Greg Kroah-Hartman
2013-03-01 19:44 ` [ 17/77] UBIFS: fix use of freed ubifs_orphan objects Greg Kroah-Hartman
2013-03-01 19:44 ` [ 18/77] UBIFS: fix double free of " Greg Kroah-Hartman
2013-03-01 19:44 ` [ 19/77] iommu/amd: Initialize device table after dma_ops Greg Kroah-Hartman
2013-03-01 19:44 ` [ 20/77] posix-timer: Dont call idr_find() with out-of-range ID Greg Kroah-Hartman
2013-03-01 19:44 ` [ 21/77] ftrace: Call ftrace cleanup module notifier after all other notifiers Greg Kroah-Hartman
2013-03-01 19:44 ` [ 22/77] x86/apic: Fix parsing of the lapic cmdline option Greg Kroah-Hartman
2013-03-01 19:44 ` [ 23/77] x86, efi: Make "noefi" really disable EFI runtime serivces Greg Kroah-Hartman
2013-03-01 19:44 ` [ 24/77] doc, xen: Mention earlyprintk=xen in the documentation Greg Kroah-Hartman
2013-03-01 19:44 ` [ 25/77] doc, kernel-parameters: Document console=hvc<n> Greg Kroah-Hartman
2013-03-01 19:44 ` [ 26/77] x86: Make sure we can boot in the case the BDA contains pure garbage Greg Kroah-Hartman
2013-03-01 19:44 ` [ 27/77] target: Fix lookup of dynamic NodeACLs during cached demo-mode operation Greg Kroah-Hartman
2013-03-01 19:44 ` [ 28/77] target: Add missing mapped_lun bounds checking during make_mappedlun setup Greg Kroah-Hartman
2013-03-01 19:44 ` [ 29/77] ocfs2: fix possible use-after-free with AIO Greg Kroah-Hartman
2013-03-01 19:44 ` [ 30/77] ocfs2: fix ocfs2_init_security_and_acl() to initialize acl correctly Greg Kroah-Hartman
2013-03-01 19:44 ` [ 31/77] ocfs2: ac->ac_allow_chain_relink=0 wont disable group relink Greg Kroah-Hartman
2013-03-01 19:44 ` [ 32/77] block: fix ext_devt_idr handling Greg Kroah-Hartman
2013-03-01 19:44 ` [ 33/77] xen-blkback: do not leak mode property Greg Kroah-Hartman
2013-03-01 19:44 ` [ 34/77] xen/blkback: Dont trust the handle from the frontend Greg Kroah-Hartman
2013-03-01 21:12 ` Paul Bolle
2013-03-02 19:48 ` Ben Hutchings
2013-03-02 22:35 ` Paul Bolle
2013-03-02 23:10 ` Ben Hutchings
2013-03-03 10:20 ` Paul Bolle
2013-03-04 2:45 ` Greg Kroah-Hartman
2013-03-04 7:55 ` Jan Beulich
2013-03-04 9:11 ` Paul Bolle
2013-03-04 9:14 ` Jan Beulich
2013-03-04 15:02 ` Konrad Rzeszutek Wilk
2013-03-12 22:10 ` Greg Kroah-Hartman
2013-04-03 14:01 ` William Dauchy
2013-04-03 16:01 ` Greg Kroah-Hartman
2013-04-03 16:38 ` Konrad Rzeszutek Wilk
2013-04-03 17:08 ` Greg Kroah-Hartman
2013-03-01 19:44 ` [ 35/77] xen-blkfront: drop the use of llist_for_each_entry_safe Greg Kroah-Hartman
2013-03-01 19:44 ` [ 36/77] xen-blkback: use balloon pages for persistent grants Greg Kroah-Hartman
2013-03-01 19:44 ` [ 37/77] idr: fix a subtle bug in idr_get_next() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 38/77] block: fix synchronization and limit check in blk_alloc_devt() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 39/77] firewire: add minor number range check to fw_device_init() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 40/77] sysctl: fix null checking in bin_dn_node_address() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 41/77] nbd: fsync and kill block device on shutdown Greg Kroah-Hartman
2013-03-01 19:44 ` [ 42/77] fs: Fix possible use-after-free with AIO Greg Kroah-Hartman
2013-03-01 19:44 ` [ 43/77] ext4: fix " Greg Kroah-Hartman
2013-03-01 19:44 ` [ 44/77] media: cx18/ivtv: fix regression: remove __init from a non-init function Greg Kroah-Hartman
2013-03-01 19:44 ` [ 45/77] media: v4l: Reset subdev v4l2_dev field to NULL if registration fails Greg Kroah-Hartman
2013-03-01 19:44 ` [ 46/77] media: omap_vout: find_vma() needs ->mmap_sem held Greg Kroah-Hartman
2013-03-01 19:44 ` [ 47/77] media: rc: unlock on error in show_protocols() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 48/77] ext4: return ENOMEM if sb_getblk() fails Greg Kroah-Hartman
2013-03-01 19:44 ` [ 49/77] ext4: check bh in ext4_read_block_bitmap() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 50/77] ext4: release sysfs kobject when failing to enable quotas on mount Greg Kroah-Hartman
2013-03-01 19:44 ` [ 51/77] ext4: fix race in ext4_mb_add_n_trim() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 52/77] ext4: fix xattr block allocation/release with bigalloc Greg Kroah-Hartman
2013-03-01 19:44 ` [ 53/77] ext4: fix free clusters calculation in bigalloc filesystem Greg Kroah-Hartman
2013-03-01 19:44 ` [ 54/77] nfsd: Fix memleak Greg Kroah-Hartman
2013-03-01 19:44 ` [ 55/77] svcrpc: make svc_age_temp_xprts enqueue under sv_lock Greg Kroah-Hartman
2013-03-01 19:44 ` [ 56/77] svcrpc: fix rpc server shutdown races Greg Kroah-Hartman
2013-03-01 19:44 ` [ 57/77] HID: add support for Sony RF receiver with USB product id 0x0374 Greg Kroah-Hartman
2013-03-01 19:44 ` [ 58/77] HID: clean up quirk for Sony RF receivers Greg Kroah-Hartman
2013-03-01 19:44 ` [ 59/77] fuse: dont WARN when nlink is zero Greg Kroah-Hartman
2013-03-01 19:44 ` [ 60/77] workqueue: consider work function when searching for busy work items Greg Kroah-Hartman
2013-03-01 19:44 ` [ 61/77] pstore: Avoid deadlock in panic and emergency-restart path Greg Kroah-Hartman
2013-03-01 19:44 ` [ 62/77] cpuset: fix cpuset_print_task_mems_allowed() vs rename() race Greg Kroah-Hartman
2013-03-01 19:44 ` [ 63/77] cgroup: fix exit() vs rmdir() race Greg Kroah-Hartman
2013-03-01 19:44 ` [ 64/77] bq27x00_battery: Fix bugs introduced with BQ27425 support Greg Kroah-Hartman
2013-03-01 19:44 ` [ 65/77] ab8500-chargalg: Only root should have write permission on sysfs file Greg Kroah-Hartman
2013-03-01 19:44 ` [ 66/77] ab8500_btemp: Demote initcall sequence Greg Kroah-Hartman
2013-03-01 19:44 ` [ 67/77] ACPI: Add DMI entry for Sony VGN-FW41E_H Greg Kroah-Hartman
2013-03-01 19:44 ` [ 68/77] staging: comedi: check s->async for poll(), read() and write() Greg Kroah-Hartman
2013-03-01 19:44 ` [ 69/77] ata_piix: IDE-mode SATA patch for Intel Avoton DeviceIDs Greg Kroah-Hartman
2013-03-01 19:44 ` [ 70/77] ata_piix: Add Device IDs for Intel Wellsburg PCH Greg Kroah-Hartman
2013-03-01 19:44 ` [ 71/77] ahci: AHCI-mode SATA patch for Intel Avoton DeviceIDs Greg Kroah-Hartman
2013-03-01 19:44 ` [ 72/77] ahci: Add Device IDs for Intel Wellsburg PCH Greg Kroah-Hartman
2013-03-01 19:44 ` [ 73/77] [hid] usb hid quirks for Masterkit MA901 usb radio Greg Kroah-Hartman
2013-03-04 11:05 ` Alexey Klimov
2013-03-04 14:25 ` Ben Hutchings
2013-03-01 19:44 ` [ 74/77] x86, efi: Allow slash in file path of initrd Greg Kroah-Hartman
2013-03-01 19:45 ` [ 75/77] ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86 Greg Kroah-Hartman
2013-03-01 19:45 ` [ 76/77] efivarfs: Validate filenames much more aggressively Greg Kroah-Hartman
2013-03-01 19:45 ` [ 77/77] efivarfs: guid part of filenames are case-insensitive Greg Kroah-Hartman
2013-03-02 3:59 ` [ 00/77] 3.8.2-stable review Shuah Khan
2013-03-02 5:21 ` Greg Kroah-Hartman
2013-03-03 11:49 ` Satoru Takeuchi
2013-03-03 15:26 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130301194352.853242357@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=bvanassche@acm.org \
--cc=dave@thedillows.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@purestorage.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox