From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
alan@lxorguk.ukuu.org.uk, Jack Wang <jack_wang@usish.com>,
John Drescher <drescherjm@gmail.com>, Dan Williams <djbw@fb.com>,
James Bottomley <JBottomley@Parallels.com>
Subject: [ 32/33] SCSI: scsi_remove_target: fix softlockup regression on hot remove
Date: Thu, 4 Oct 2012 14:26:54 -0700 [thread overview]
Message-ID: <20121004210602.465725208@linuxfoundation.org> (raw)
In-Reply-To: <20121004210558.383865383@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <djbw@fb.com>
commit bc3f02a795d3b4faa99d37390174be2a75d091bd upstream.
John reports:
BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
[..]
Call Trace:
[<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
[<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
[<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
[<ffffffff81421e35>] sas_port_delete+0x25/0x160
[<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270
...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".
Don't restart lookup of more stargets in the multi-target case, just
arrange to traverse the list once, on the assumption that new targets
are always added at the end. There is no guarantee that the target will
change state in scsi_target_reap() so we can end up spinning if we
restart.
Acked-by: Jack Wang <jack_wang@usish.com>
LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
Reported-by: John Drescher <drescherjm@gmail.com>
Tested-by: John Drescher <drescherjm@gmail.com>
Signed-off-by: Dan Williams <djbw@fb.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/scsi_sysfs.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -988,33 +988,31 @@ static void __scsi_remove_target(struct
void scsi_remove_target(struct device *dev)
{
struct Scsi_Host *shost = dev_to_shost(dev->parent);
- struct scsi_target *starget, *found;
+ struct scsi_target *starget, *last = NULL;
unsigned long flags;
- restart:
- found = NULL;
+ /* remove targets being careful to lookup next entry before
+ * deleting the last
+ */
spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry(starget, &shost->__targets, siblings) {
if (starget->state == STARGET_DEL)
continue;
if (starget->dev.parent == dev || &starget->dev == dev) {
- found = starget;
- found->reap_ref++;
- break;
+ /* assuming new targets arrive at the end */
+ starget->reap_ref++;
+ spin_unlock_irqrestore(shost->host_lock, flags);
+ if (last)
+ scsi_target_reap(last);
+ last = starget;
+ __scsi_remove_target(starget);
+ spin_lock_irqsave(shost->host_lock, flags);
}
}
spin_unlock_irqrestore(shost->host_lock, flags);
- if (found) {
- __scsi_remove_target(found);
- scsi_target_reap(found);
- /* in the case where @dev has multiple starget children,
- * continue removing.
- *
- * FIXME: does such a case exist?
- */
- goto restart;
- }
+ if (last)
+ scsi_target_reap(last);
}
EXPORT_SYMBOL(scsi_remove_target);
next prev parent reply other threads:[~2012-10-04 21:28 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 21:26 [ 00/33] 3.0.45-stable review Greg Kroah-Hartman
2012-10-04 21:26 ` [ 01/33] vfs: dcache: fix deadlock in tree traversal Greg Kroah-Hartman
2012-10-04 21:26 ` [ 02/33] dm: handle requests beyond end of device instead of using BUG_ON Greg Kroah-Hartman
2012-10-04 21:26 ` [ 03/33] USB: option: blacklist QMI interface on ZTE MF683 Greg Kroah-Hartman
2012-10-04 21:26 ` [ 04/33] USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support Greg Kroah-Hartman
2012-10-04 21:26 ` [ 05/33] USB: qcaux: add Pantech vendor class match Greg Kroah-Hartman
2012-10-04 21:26 ` [ 06/33] staging: speakup_soft: Fix reading of init string Greg Kroah-Hartman
2012-10-04 21:26 ` [ 07/33] staging: comedi: s626: dont dereference insn->data Greg Kroah-Hartman
2012-10-04 21:26 ` [ 08/33] staging: comedi: jr3_pci: fix iomem dereference Greg Kroah-Hartman
2012-10-04 21:26 ` [ 09/33] staging: comedi: dont dereference user memory for INSN_INTTRIG Greg Kroah-Hartman
2012-10-04 21:26 ` [ 10/33] staging: comedi: fix memory leak for saved channel list Greg Kroah-Hartman
2012-10-04 21:26 ` [ 11/33] Remove BUG_ON from n_tty_read() Greg Kroah-Hartman
2012-10-04 21:26 ` [ 12/33] TTY: ttyprintk, dont touch behind tty->write_buf Greg Kroah-Hartman
2012-10-04 21:26 ` [ 13/33] serial: pl011: handle corruption at high clock speeds Greg Kroah-Hartman
2012-10-04 21:26 ` [ 14/33] serial: set correct baud_base for EXSYS EX-41092 Dual 16950 Greg Kroah-Hartman
2012-10-04 21:26 ` [ 15/33] b43legacy: Fix crash on unload when firmware not available Greg Kroah-Hartman
2012-10-04 21:26 ` [ 16/33] firmware: Add missing attributes to EFI variable attribute print out from sysfs Greg Kroah-Hartman
2012-10-04 21:26 ` [ 17/33] xhci: Intel Panther Point BEI quirk Greg Kroah-Hartman
2012-10-04 21:26 ` [ 18/33] n_gsm: added interlocking for gsm_data_lock for certain code paths Greg Kroah-Hartman
2012-10-04 21:26 ` [ 19/33] coredump: prevent double-free on an error path in core dumper Greg Kroah-Hartman
2012-10-04 21:26 ` [ 20/33] Increase XHCI suspend timeout to 16ms Greg Kroah-Hartman
2012-10-04 21:26 ` [ 21/33] n_gsm: memory leak in uplink error path Greg Kroah-Hartman
2012-10-04 21:26 ` [ 22/33] UBI: fix autoresize handling in R/O mode Greg Kroah-Hartman
2012-10-04 21:26 ` [ 23/33] SCSI: ibmvscsi: Fix host config length field overflow Greg Kroah-Hartman
2012-10-04 21:26 ` [ 24/33] SCSI: hpsa: Use LUN reset instead of target reset Greg Kroah-Hartman
2012-10-04 21:26 ` [ 25/33] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock() Greg Kroah-Hartman
2012-10-04 21:26 ` [ 26/33] IPoIB: Fix use-after-free of multicast object Greg Kroah-Hartman
2012-10-04 21:26 ` [ 27/33] IB/srp: Fix use-after-free in srp_reset_req() Greg Kroah-Hartman
2012-10-04 21:26 ` [ 28/33] IB/srp: Avoid having aborted requests hang Greg Kroah-Hartman
2012-10-04 21:26 ` [ 29/33] isci: fix isci_pci_probe() generates warning on efi failure path Greg Kroah-Hartman
2012-10-04 21:26 ` [ 30/33] x86/alternatives: Fix p6 nops on non-modular kernels Greg Kroah-Hartman
2012-10-04 21:26 ` [ 31/33] PCI: honor child buses add_size in hot plug configuration Greg Kroah-Hartman
2012-10-04 21:26 ` Greg Kroah-Hartman [this message]
2012-10-04 21:26 ` [ 33/33] SCSI: scsi_dh_alua: Enable STPG for unavailable ports 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=20121004210602.465725208@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=JBottomley@Parallels.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=djbw@fb.com \
--cc=drescherjm@gmail.com \
--cc=jack_wang@usish.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).