code in GEOM thread could not use vnode API (Was: alq_open_flags() panics in _mtx_lock_flags())

Lev Serebryakov lev at FreeBSD.org
Sun Oct 2 19:15:09 UTC 2011


Hello, Current.
You wrote 2 октября 2011 г., 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 = 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=12, code=0, tf=0xc4e29990)
>     at /usr/home/lev/FreeBSD-head/sys/kern/subr_kdb.c:620
> #6  0xc08290af in trap_fatal (frame=0xc4e29990, eva=136)
>     at /usr/home/lev/FreeBSD-head/sys/i386/i386/trap.c:958
> #7  0xc08292c0 in trap_pfault (frame=0xc4e29990, usermode=0, eva=136)
>     at /usr/home/lev/FreeBSD-head/sys/i386/i386/trap.c:880
> #8  0xc0829f46 in trap (frame=0xc4e29990)
>     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=0x78, opts=0, 
>     file=0xc088c140 "/usr/home/lev/FreeBSD-head/sys/kern/vfs_subr.c", 
>     line=2169) at /usr/home/lev/FreeBSD-head/sys/kern/kern_mutex.c:194
> #11 0xc0672eb2 in vref (vp=0x0)
>     at /usr/home/lev/FreeBSD-head/sys/kern/vfs_subr.c:2169
> #12 0xc066932f in namei (ndp=0xc4e29b74)
>     at /usr/home/lev/FreeBSD-head/sys/kern/vfs_lookup.c:264
> #13 0xc0682900 in vn_open_cred (ndp=0xc4e29b74, flagp=0xc4e29be8, cmode=384,
>     vn_open_flags=0, cred=0xc50fee80, fp=0x0)
>     at /usr/home/lev/FreeBSD-head/sys/kern/vfs_vnops.c:137
> #14 0xc5c42609 in alq_open_flags (alqp=0xc550dc08, 
>     file=0xc5108d40 "/usr/ada4.log", cred=0xc50fee80, cmode=384, size=28,
>     flags=16)
>     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?!

-- 
// Black Lion AKA Lev Serebryakov <lev at FreeBSD.org>



More information about the freebsd-fs mailing list