svn commit: r328554 - head/sys/cam/scsi

Dexuan Cui decui at microsoft.com
Tue Mar 13 03:00:19 UTC 2018


Hi Warner,
Sorry, I need to make a correction: acutally it looks the panic can NOT reproduce with stable/11 or the latest master branch. This is great! :-)

Actually I was using an old version of the master branch that doesn’t have r328554 yet, and I could 100% reproduce the issue. If I manually apply r328554, or I use the latest master branch, the panic can’t happen any more.

So, it looks here we don’t need to MFC any patch to stable/11.

Thanks,
-- Dexuan

From: wlosh at bsdimp.com <wlosh at bsdimp.com> On Behalf Of Warner Losh
Sent: Monday, March 12, 2018 09:45
To: Dexuan-BSD Cui <dexuan.bsd at gmail.com>
Cc: Warner Losh <imp at freebsd.org>; src-committers <src-committers at freebsd.org>; svn-src-all at freebsd.org; svn-src-head at freebsd.org; Dexuan Cui <decui at microsoft.com>
Subject: Re: svn commit: r328554 - head/sys/cam/scsi


This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing<http://aka.ms/LearnAboutSpoofing>

Feedback<http://aka.ms/SafetyTipsFeedback>

I think this is a good idea to MFC. We've had no reports of it causing issues.

There's more extensive locking changes / tweaks needed for da that just went in that likely should also be MFC'd.

Warner

On Sun, Mar 11, 2018 at 9:17 PM, Dexuan-BSD Cui <dexuan.bsd at gmail.com<mailto:dexuan.bsd at gmail.com>> wrote:
Hi imp and all,
I think this patch is very important, because it can fix a panic I
noticed recently when I try to hot-remove a SCSI disk from a VM
running on Azure/Hyper-V.

The panic is almost 100% reproducible with stable/11, but not in the
latest CURRENT code, so finally I identified this fix in the CURRENT
branch.

Can you please MFC this patch to 11 and 10?
It looks there is a major difference in the CAM code between 11/10
and the CURRENT code, and we may have to MFC more related patches. If
this is difficult, I hope at least we can provide a minimal re-written
version of the patch to 11 and 10?

Looking forward to your insight!

Thanks,
-- Dexuan


On Mon, Jan 29, 2018 at 10:07 AM, Warner Losh <imp at freebsd.org<mailto:imp at freebsd.org>> wrote:
> Author: imp
> Date: Mon Jan 29 18:07:14 2018
> New Revision: 328554
> URL: https://svnweb.freebsd.org/changeset/base/328554<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsvnweb.freebsd.org%2Fchangeset%2Fbase%2F328554&data=04%7C01%7Cdecui%40microsoft.com%7Ce4d8e3802c8c48bf969808d58838904f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636564698908750058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C100&sdata=SuKthNA5u96YZYfGmFTKTkCHI%2F5nIje9uWdphapANlY%3D&reserved=0>
>
> Log:
>   Do the book-keeping on release before we release the reference. The
>   periph was going away on final release, and then returning and we
>   started dancing in free memory.
>
>   Sponsored by: Netflix
>
> Modified:
>   head/sys/cam/scsi/scsi_da.c
>
> Modified: head/sys/cam/scsi/scsi_da.c
> ==============================================================================
> --- head/sys/cam/scsi/scsi_da.c Mon Jan 29 17:32:30 2018        (r328553)
> +++ head/sys/cam/scsi/scsi_da.c Mon Jan 29 18:07:14 2018        (r328554)
> @@ -1549,12 +1549,12 @@ da_periph_unhold(struct cam_periph *periph, da_ref_tok
>         struct da_softc *softc = periph->softc;
>
>         token_sanity(token);
> -       cam_periph_unhold(periph);
>         DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n",
>             da_ref_text[token], token);
>         cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
>         if (cnt != 1)
>                 panic("Unholding %d with cnt = %d", token, cnt);
> +       cam_periph_unhold(periph);
>  }
>
>  static inline int
> @@ -1583,12 +1583,12 @@ da_periph_release(struct cam_periph *periph, da_ref_to
>         struct da_softc *softc = periph->softc;
>
>         token_sanity(token);
> -       cam_periph_release(periph);
>         DA_PERIPH_PRINT(periph, "releasing device %s (%d)\n",
>             da_ref_text[token], token);
>         cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
>         if (cnt != 1)
>                 panic("Releasing %d with cnt = %d", token, cnt);
> +       cam_periph_release(periph);
>  }
>
>  static inline void
> @@ -1598,12 +1598,12 @@ da_periph_release_locked(struct cam_periph *periph, da
>         struct da_softc *softc = periph->softc;
>
>         token_sanity(token);
> -       cam_periph_release_locked(periph);
>         DA_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n",
>             da_ref_text[token], token);
>         cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
>         if (cnt != 1)
>                 panic("Unholding %d with cnt = %d", token, cnt);
> +       cam_periph_release_locked(periph);
>  }
>
>  #define cam_periph_hold POISON
>



More information about the svn-src-head mailing list