Date: Sun, 24 Jan 2016 20:50:50 +0100 From: Marius Strobl <marius@alchemy.franken.de> To: Andrea Venturoli <ml@netfence.it> Cc: freebsd-stable@freebsd.org, freebsd-questions@freebsd.org Subject: Re: Panic with sym on 10.2 Message-ID: <20160124195050.GA19171@alchemy.franken.de> In-Reply-To: <569E4ABB.9070903@netfence.it> References: <569E368F.4060802@netfence.it> <569E45D9.1050604@freebsd.org> <569E4ABB.9070903@netfence.it>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tue, Jan 19, 2016 at 03:39:55PM +0100, Andrea Venturoli wrote:
> On 01/19/16 15:19, Matthew Seaman wrote:
> > On 01/19/16 13:13, Andrea Venturoli wrote:
> >> Two days ago I upgraded a (perfectly working) 9.3/i386 box to 10.2p10
> >> Since then I've had two panics with the following message:
> >>
> >> panic: assertion "lp->busy_itl==0&&lp->busy_itlq==0" failed: file
> >> /usr/src/sys/dev/sym/sym_hipd.c
> >>
> >> Since the disk controller is involved, I do not get any core and I have
> >> to press the reset button.
> >>
> >> Google showed up no results (I'm not using ZFS, btw) and Bugzilla didn't
> >> help either.
> >>
These debugging assertions in sym_get_ccb() probably can just be
replaced with graceful handling (see the attached patch). I'm
unsure whether it's sufficient to tell the CAM stack to retry at
a later point, though, and given I'm not hitting this problem I
also can't test. Unlike SCSI-2, SCSI-3 generally allows to mix a
single untagged command with tagged ones (the situation you are
encountering), which FreeBSD apparently started doing somewhere
between 9.3 and 10.2. However, permitting that would require a
careful review of sym(4) and most likely larger changes.
Marius
[-- Attachment #2 --]
Index: sym_hipd.c
===================================================================
--- sym_hipd.c (revision 294669)
+++ sym_hipd.c (working copy)
@@ -6296,14 +6296,13 @@ static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_c
goto out_free;
} else {
/*
- * If we have been asked for a tagged command.
+ * If we have been asked for a tagged command, refuse
+ * to overlap with an existing untagged one.
*/
if (tag_order) {
+ if (lp->busy_itl != 0)
+ goto out_free;
/*
- * Debugging purpose.
- */
- assert(lp->busy_itl == 0);
- /*
* Allocate resources for tags if not yet.
*/
if (!lp->cb_tags) {
@@ -6335,22 +6334,17 @@ static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_c
* one, refuse to overlap this untagged one.
*/
else {
+ if (lp->busy_itlq != 0 || lp->busy_itl != 0)
+ goto out_free;
/*
- * Debugging purpose.
- */
- assert(lp->busy_itl == 0 && lp->busy_itlq == 0);
- /*
* Count this nexus for this LUN.
* Set up the CCB bus address for reselection.
* Toggle reselect path to untagged.
*/
- if (++lp->busy_itl == 1) {
- lp->head.itl_task_sa = cpu_to_scr(cp->ccb_ba);
- lp->head.resel_sa =
- cpu_to_scr(SCRIPTA_BA (np, resel_no_tag));
- }
- else
- goto out_free;
+ lp->busy_itl = 1;
+ lp->head.itl_task_sa = cpu_to_scr(cp->ccb_ba);
+ lp->head.resel_sa =
+ cpu_to_scr(SCRIPTA_BA (np, resel_no_tag));
}
}
/*
@@ -6396,7 +6390,7 @@ static void sym_free_ccb(hcb_p np, ccb_p cp)
*/
if (lp) {
/*
- * If tagged, release the tag, set the relect path
+ * If tagged, release the tag, set the reselect path.
*/
if (cp->tag != NO_TAG) {
/*
@@ -6417,7 +6411,7 @@ static void sym_free_ccb(hcb_p np, ccb_p cp)
* and uncount this CCB.
*/
lp->head.itl_task_sa = cpu_to_scr(np->bad_itl_ba);
- --lp->busy_itl;
+ lp->busy_itl = 0;
}
/*
* If no JOB active, make the LUN reselect path invalid.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160124195050.GA19171>
