Re: gnop panic with recent kernel (r256923)

From: Keith White <kwhite_at_site.uottawa.ca>
Date: Tue, 22 Oct 2013 21:15:45 -0400 (EDT)
On Wed, 23 Oct 2013, Mateusz Guzik wrote:

> On Tue, Oct 22, 2013 at 07:59:29PM -0400, Keith White wrote:
>> I get a "gnop lock" panic when trying to create a gnop device:
>>
>> 	# gnop create -S 4k ada3
>>
>> panic: lock "gnop lock" 0xfffff80002566640 already initialized
>>
>>
>> # kgdb /boot/kernel.r256923/kernel /var/crash/vmcore.last
>> ...
>> Unread portion of the kernel message buffer:
>> panic: lock "gnop lock" 0xfffff80002566640 already initialized
>> cpuid = 1
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00934f3830
>> kdb_backtrace() at kdb_backtrace+0x39/frame 0xfffffe00934f38e0
>> vpanic() at vpanic+0x126/frame 0xfffffe00934f3920
>> kassert_panic() at kassert_panic+0x136/frame 0xfffffe00934f3990
>> lock_init() at lock_init+0x43/frame 0xfffffe00934f39e0
>> _mtx_init() at _mtx_init+0x7c/frame 0xfffffe00934f3a20
>> g_nop_config() at g_nop_config+0x51a/frame 0xfffffe00934f3b30
>> g_ctl_req() at g_ctl_req+0x100/frame 0xfffffe00934f3b70
>> g_run_events() at g_run_events+0x1a7/frame 0xfffffe00934f3bb0
>> fork_exit() at fork_exit+0x84/frame 0xfffffe00934f3bf0
>> fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00934f3bf0
>> --- trap 0, rip = 0, rsp = 0xfffffe00934f3cb0, rbp = 0 ---
>>
>> (kgdb) bt #0  doadump (textdump=1) at pcpu.h:219
>> #1  0xffffffff808bbb57 in kern_reboot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:447
>> #2  0xffffffff808bc065 in vpanic (fmt=<value optimized out>, ap=<value optimized out>) at /usr/src/sys/kern/kern_shutdown.c:754
>> #3  0xffffffff808bbef6 in kassert_panic (fmt=<value optimized out>) at /usr/src/sys/kern/kern_shutdown.c:642
>> #4  0xffffffff808f47c3 in lock_init (lock=0xfffff80002566640, class=0xffffffff813e9ce0, name=0xffffffff81c947ce "gnop lock", type=0x0, flags=131072) at /usr/src/sys/kern/subr_lock.c:81
>> #5  0xffffffff808a8acc in _mtx_init (c=0xfffff80002566658, name=0xffffffff81c947ce "gnop lock", type=0x0, opts=<value optimized out>) at /usr/src/sys/kern/kern_mutex.c:905
>> #6  0xffffffff81c9351a in g_nop_config (req=0xfffff800052a48c0, mp=0xffffffff81c94a20, verb=<value optimized out>) at /usr/src/sys/modules/geom/geom_nop/../../../geom/nop/g_nop.c:229
>> #7  0xffffffff8081d790 in g_ctl_req (arg=0xfffff800052a48c0, flag=<value optimized out>) at /usr/src/sys/geom/geom_ctl.c:454
>> #8  0xffffffff80820d27 in g_run_events () at /usr/src/sys/geom/geom_event.c:257
>> #9  0xffffffff8088b094 in fork_exit (callout=0xffffffff80822df0 <g_event_procbody>, arg=0x0, frame=0xfffffe00934f3c00) at /usr/src/sys/kern/kern_fork.c:995
>> #10 0xffffffff80c9bf4e in fork_trampoline () at /usr/src/sys/amd64/amd64/exception.S:606
>> #11 0x0000000000000000 in ?? ()
>> Current language:  auto; currently minimal
>> (kgdb)
>>
>> ...keith
>
> Try this (untested):
> diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
> index e6b44bb..bd72d78 100644
> --- a/sys/geom/nop/g_nop.c
> +++ b/sys/geom/nop/g_nop.c
> _at__at_ -216,7 +216,7 _at__at_ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
> 		}
> 	}
> 	gp = g_new_geomf(mp, "%s", name);
> -	sc = g_malloc(sizeof(*sc), M_WAITOK);
> +	sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
> 	sc->sc_offset = offset;
> 	sc->sc_explicitsize = explicitsize;
> 	sc->sc_error = ioerror;
>
> -- 
> Mateusz Guzik <mjguzik gmail.com>

Yes, that fixes it for me.

Thanks!

...keith
Received on Tue Oct 22 2013 - 23:15:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:43 UTC