From owner-freebsd-current@FreeBSD.ORG Wed Oct 23 00:49:27 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 917AADF1 for ; Wed, 23 Oct 2013 00:49:27 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2BAE2250D for ; Wed, 23 Oct 2013 00:49:27 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id h11so6568200wiv.4 for ; Tue, 22 Oct 2013 17:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=NhQQWNBlSB1FKYtK7NLlINi/nEw8vh3yyuyUSexsEI4=; b=lVGZD1hIA4OGM7/qWl+Hm0r6MAUR66Digh7dFXqawgxmA4/LMF+CirYQPF2ec1ei+q BTbso5XJc35ujP0OYezorYQpEomYktHOivKhFk1JOQlwnyo6MDREi+5ik0iLIdgeK4vS O98Nhv/x57x2JPEhD3wOTNQiMRtEKr8PWynTbB2KpZqLfEr76R/KU9EsolbcTGjPy5Xi pd0sD7ZOrG8jQeyWau2EUwdxFOoImRRmLdOET3qgC7xKocZRKq9KBalIG0WIURk1yslQ 6H6uOanqkQVHxV4zFofyYPb+QxA4BUFuA0k3nZe3ytj7CnsA9cvMlbj65d4sISQdz1Rn UWlQ== X-Received: by 10.181.11.163 with SMTP id ej3mr16452883wid.47.1382489365610; Tue, 22 Oct 2013 17:49:25 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fr4sm11502742wib.0.2013.10.22.17.49.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Oct 2013 17:49:23 -0700 (PDT) Date: Wed, 23 Oct 2013 02:49:21 +0200 From: Mateusz Guzik To: Keith White Subject: Re: gnop panic with recent kernel (r256923) Message-ID: <20131023004921.GA3421@dft-labs.eu> Mail-Followup-To: Mateusz Guzik , Keith White , freebsd-current@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 00:49:27 -0000 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=, ap=) at /usr/src/sys/kern/kern_shutdown.c:754 > #3 0xffffffff808bbef6 in kassert_panic (fmt=) 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=) at /usr/src/sys/kern/kern_mutex.c:905 > #6 0xffffffff81c9351a in g_nop_config (req=0xfffff800052a48c0, mp=0xffffffff81c94a20, verb=) at /usr/src/sys/modules/geom/geom_nop/../../../geom/nop/g_nop.c:229 > #7 0xffffffff8081d790 in g_ctl_req (arg=0xfffff800052a48c0, flag=) 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 , 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 @@ -216,7 +216,7 @@ 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