Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2011 16:18:59 +0400
From:      Lev Serebryakov <lev@FreeBSD.org>
To:        Lawrence Stewart <lstewart@freebsd.org>
Cc:        fs@freebsd.org
Subject:   Re: code in GEOM thread could not use vnode API (Was: alq_open_flags() panics in _mtx_lock_flags())
Message-ID:  <1223820108.20111003161859@serebryakov.spb.ru>
In-Reply-To: <4E8986F0.3050007@freebsd.org>
References:  <1258376930.20111002193223@serebryakov.spb.ru> <228926402.20111002231459@serebryakov.spb.ru> <349860851.20111003113417@serebryakov.spb.ru> <4E8986F0.3050007@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
------------D513F1DB29DF10BB
Content-Type: text/plain; charset=windows-1251
Content-Transfer-Encoding: quoted-printable

Hello, Lawrence.
You wrote 3 =EE=EA=F2=FF=E1=F0=FF 2011 =E3., 13:57:04:

> I know nothing about VFS, but wonder if it's something to do with the
> credentials you pass in?
  They looks Ok. Not NULL, at least :) I'm passing
 "curtrhead->td_ucred".

> Lev, are you able to share your code with us?
  Yes, of course. Minimal code, which trigger this error, attached.
 Build, load module and PANIC!

  This is geom_zero module, which try to create ALQ with name
  "/var/log/zero.alq.log" on it load (not creation! So, you don't need
  even create such GEOM!). Please note, that "init" callback of GEOM
  class is called in g_event GEOM thread.

   Code is for 9.0/10.0

  My code is rewritten with usage of working thread already, and it
works without any panic. But worker thread looks like overkill for
simple case "write 24 bytes record to ALQ for each BIO" to me.

  So I could prove, that this code PANIC because alq_open_flags() is
 called from one of three GEOM threads.

--=20
// Black Lion AKA Lev Serebryakov <lev@FreeBSD.org>
------------D513F1DB29DF10BB
Content-Type: application/octet-stream;
 name="g_alq.c"
Content-transfer-encoding: base64
Content-Disposition: attachment;
 filename="g_alq.c"

LyotCiAqIENvcHlyaWdodCAoYykgMjAwNSBQYXdlbCBKYWt1YiBEYXdpZGVrIDxwamRARnJl
ZUJTRC5vcmc+CiAqIEFsbCByaWdodHMgcmVzZXJ2ZWQuCiA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K
------------D513F1DB29DF10BB
Content-Type: application/octet-stream;
 name=Makefile
Content-transfer-encoding: base64
Content-Disposition: attachment;
 filename=Makefile

Q0xBU1M9CWFscQoKS0VSTkJVSUxEUk9PVCE9CW1ha2UgLUMgL3Vzci9zcmMvc3lzIC1WIC5P
QkpESVIKS0VSTk5BTUUhPQkJdW5hbWUgLWkKLmlmIGV4aXN0cygke0tFUk5CVUlMRFJPT1R9
LyR7S0VSTk5BTUV9L29wdF9nbG9iYWwuaCkgJiYgIWRlZmluZWQoS0VSTkJVSUxERElSKQpL
RVJOQlVJTERESVI6PSR7S0VSTkJVSUxEUk9PVH0vJHtLRVJOTkFNRX0KLmVuZGlmCgpLTU9E
RElSPz0JL2Jvb3QvbW9kdWxlcwoKS01PRD0JZ2VvbV8ke0NMQVNTfQpTUkNTPQlnXyR7Q0xB
U1N9LmMKCi5pbmNsdWRlIDxic2Qua21vZC5taz4K
------------D513F1DB29DF10BB--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1223820108.20111003161859>