From owner-freebsd-current@FreeBSD.ORG Sun Oct 2 19:15:08 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2B88106566B; Sun, 2 Oct 2011 19:15:08 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.friendlyhosting.spb.ru (onlyone.friendlyhosting.spb.ru [IPv6:2a01:4f8:131:60a2::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6182D8FC13; Sun, 2 Oct 2011 19:15:08 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (unknown [IPv6:2001:470:923f:1:906c:6af3:5301:18c6]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.friendlyhosting.spb.ru (Postfix) with ESMTPA id 159014AC1C; Sun, 2 Oct 2011 23:15:06 +0400 (MSD) Date: Sun, 2 Oct 2011 23:14:59 +0400 From: Lev Serebryakov Organization: FreeBSD X-Priority: 3 (Normal) Message-ID: <228926402.20111002231459@serebryakov.spb.ru> To: current@freebsd.org, fs@FreeBSD.org, geom@freebsd.org In-Reply-To: <1258376930.20111002193223@serebryakov.spb.ru> References: <1258376930.20111002193223@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable Cc: Subject: code in GEOM thread could not use vnode API (Was: alq_open_flags() panics in _mtx_lock_flags()) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: lev@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 19:15:09 -0000 Hello, Current. You wrote 2 =EE=EA=F2=FF=E1=F0=FF 2011 =E3., 19:32:23: It seems, that error only occurs when I call alq API from geom threads (from g_events, for example). Module, which is not GEOM class, could use this API without any problem! Is it normal, that GEOM could not use vnode API? Is it normal, that this leads to panic, and not some diagnostic messages, even with WITNESS and other diagnostic options turned on? I'm looping fs@ and geom@, as it seems to be related to them. > I'm trying to create logging queue with alq kernel API. I call > alq_open_flags() like this in my module: > error =3D alq_open_flags(&sc->sc_alq, sc->sc_vnode_name, > curthread->td_ucred, ALQ_DEFAULT_CMODE, > sizeof(struct g_log_entry), ALQ_ORDERED); > and my system (10-CURRENT) panics with this stack trace (top frames > are DDB-related, so I omit them): > #5 0xc06101c3 in kdb_trap (type=3D12, code=3D0, tf=3D0xc4e29990) > at /usr/home/lev/FreeBSD-head/sys/kern/subr_kdb.c:620 > #6 0xc08290af in trap_fatal (frame=3D0xc4e29990, eva=3D136) > at /usr/home/lev/FreeBSD-head/sys/i386/i386/trap.c:958 > #7 0xc08292c0 in trap_pfault (frame=3D0xc4e29990, usermode=3D0, eva=3D13= 6) > at /usr/home/lev/FreeBSD-head/sys/i386/i386/trap.c:880 > #8 0xc0829f46 in trap (frame=3D0xc4e29990) > at /usr/home/lev/FreeBSD-head/sys/i386/i386/trap.c:555 > #9 0xc0812e7c in calltrap () > at /usr/home/lev/FreeBSD-head/sys/i386/i386/exception.s:168 > #10 0xc05cafc0 in _mtx_lock_flags (m=3D0x78, opts=3D0,=20 > file=3D0xc088c140 "/usr/home/lev/FreeBSD-head/sys/kern/vfs_subr.c",= =20 > line=3D2169) at /usr/home/lev/FreeBSD-head/sys/kern/kern_mutex.c:194 > #11 0xc0672eb2 in vref (vp=3D0x0) > at /usr/home/lev/FreeBSD-head/sys/kern/vfs_subr.c:2169 > #12 0xc066932f in namei (ndp=3D0xc4e29b74) > at /usr/home/lev/FreeBSD-head/sys/kern/vfs_lookup.c:264 > #13 0xc0682900 in vn_open_cred (ndp=3D0xc4e29b74, flagp=3D0xc4e29be8, cmo= de=3D384, > vn_open_flags=3D0, cred=3D0xc50fee80, fp=3D0x0) > at /usr/home/lev/FreeBSD-head/sys/kern/vfs_vnops.c:137 > #14 0xc5c42609 in alq_open_flags (alqp=3D0xc550dc08,=20 > file=3D0xc5108d40 "/usr/ada4.log", cred=3D0xc50fee80, cmode=3D384, si= ze=3D28, > flags=3D16) > at > /usr/home/lev/FreeBSD-head/sys/modules/alq/../../kern/kern_alq.c:451 > It seems, that vref() get NULL instead of valid pointer to struct > vnode. But I have no idea -- why?! Yes, I have no such file created, > but man alq(9) says, that it will create file for me. And if I point > to existed file, it panic anyway. > What do I do wrong?! --=20 // Black Lion AKA Lev Serebryakov