Date: Sun, 11 Mar 2018 20:17:02 -0700 From: Dexuan-BSD Cui <dexuan.bsd@gmail.com> To: Warner Losh <imp@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Dexuan Cui <decui@microsoft.com> Subject: Re: svn commit: r328554 - head/sys/cam/scsi Message-ID: <CABkgQk_QXs7yoTbUe=ZCTyyVLoo_-_0aGHU_q8RfimiMmLoO1Q@mail.gmail.com> In-Reply-To: <201801291807.w0TI7EVD092154@repo.freebsd.org> References: <201801291807.w0TI7EVD092154@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd.org> wrote: > Author: imp > Date: Mon Jan 29 18:07:14 2018 > New Revision: 328554 > URL: https://svnweb.freebsd.org/changeset/base/328554 > > 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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABkgQk_QXs7yoTbUe=ZCTyyVLoo_-_0aGHU_q8RfimiMmLoO1Q>