[sysctl] New sysctl LoR today
Sean Bruno
sean.bruno at dsl-only.net
Wed Feb 11 08:26:29 PST 2009
On Wed, 2009-02-11 at 09:46 -0500, John Baldwin wrote:
> On Wednesday 11 February 2009 1:09:28 am Sean Bruno wrote:
> > On Tue, 2009-02-10 at 17:23 -0800, Sean Bruno wrote:
> > > I'm working on some items in the firewire stack and after a update, I
> > > was greeted with a new LoR against the SYSCTL lock. I noted that some
> > > things were changing in that space.
> > >
> > > Did I miss an interface change that I need to pickup in the firewire
> > > stack?
> > >
> > > Sean
> > >
> > > lock order reversal: (sleepable after non-sleepable)
> > > 1st 0xc471bbec sbp (sbp) @ dev/firewire/sbp.c:2253
> > > 2nd 0xc0d3aea4 sysctl lock (sysctl lock) @ kern/kern_sysctl.c:250
> > > KDB: stack backtrace:
> > > _sx_xlock(c0d3aea4,0,c0be5d46,fa,c471a000,...) at _sx_xlock+0x85
> > > sysctl_ctx_free(c471a2c0,c0b8f786,c0d0696c,0,c469fa0c,...) at
> > > sysctl_ctx_free+0x30
> > > dacleanup(c4c54700,c0b900bb,c480e000,c42aa410,246,...) at dacleanup+0x35
> > > camperiphfree(c4c54700,c4c54700,c42aa694,c047763d,c4c54700,...) at
>
> No, this is due to CAM calling sysctl_ctx_free() with a lock held. You can
> try this change:
>
> --- //depot/user/jhb/lock/cam/scsi/scsi_cd.c
> +++ /home/jhb/work/p4/lock/cam/scsi/scsi_cd.c
> @@ -401,11 +401,6 @@
>
> xpt_print(periph->path, "removing device entry\n");
>
> - if ((softc->flags & CD_FLAG_SCTX_INIT) != 0
> - && sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
> - xpt_print(periph->path, "can't remove sysctl context\n");
> - }
> -
> /*
> * In the queued, non-active case, the device in question
> * has already been removed from the changer run queue. Since this
> @@ -474,9 +469,14 @@
> free(softc->changer, M_DEVBUF);
> }
> cam_periph_unlock(periph);
> + if ((softc->flags & CD_FLAG_SCTX_INIT) != 0
> + && sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
> + xpt_print(periph->path, "can't remove sysctl context\n");
> + }
> +
> disk_destroy(softc->disk);
> + free(softc, M_DEVBUF);
> cam_periph_lock(periph);
> - free(softc, M_DEVBUF);
> }
>
> static void
> --- //depot/user/jhb/lock/cam/scsi/scsi_da.c
> +++ /home/jhb/work/p4/lock/cam/scsi/scsi_da.c
> @@ -995,6 +995,8 @@
> softc = (struct da_softc *)periph->softc;
>
> xpt_print(periph->path, "removing device entry\n");
> + cam_periph_unlock(periph);
> +
> /*
> * If we can't free the sysctl tree, oh well...
> */
> @@ -1003,11 +1005,10 @@
> xpt_print(periph->path, "can't remove sysctl context\n");
> }
>
> - cam_periph_unlock(periph);
> disk_destroy(softc->disk);
> callout_drain(&softc->sendordered_c);
> + free(softc, M_DEVBUF);
> cam_periph_lock(periph);
> - free(softc, M_DEVBUF);
> }
>
> static void
>
>
Yup. Thanks for the quick fix!
Sean
More information about the freebsd-current
mailing list