From owner-freebsd-current@FreeBSD.ORG Thu Sep 26 12:57:44 2013 Return-Path: Delivered-To: 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 6F7ECE45; Thu, 26 Sep 2013 12:57:44 +0000 (UTC) (envelope-from sergey.dyatko@gmail.com) Received: from mail-ee0-x22c.google.com (mail-ee0-x22c.google.com [IPv6:2a00:1450:4013:c00::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D33632845; Thu, 26 Sep 2013 12:57:43 +0000 (UTC) Received: by mail-ee0-f44.google.com with SMTP id b47so529777eek.17 for ; Thu, 26 Sep 2013 05:57:42 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=3ahsiGBqCC5/EjCqw0U980Xp3kw1whH62wXLxPFoVJg=; b=OG66mSJVH8dwDOdMyJTvdYjC6o1aO6//tqH+52o0HnKoyAwMRcWxwT981nJUaGnDle qeeAvvl4RD/wq3MYhzsRvz+PdeMgLOThgv5oAN+XnWXzfjtmCUwWdJpXzEnEVZMUlK3j WxWZfR23YKKwxYp3aZB9USHmCL4UjzGX/xC8Ub0u29L1Pw2fMWF3UWt287uQ6lCQ7fVg ijb8OLDE8JhwaY1VJEhBGeAg326uw90moKNnAcTnJa1cgVRl5LnJ6owpwuncgRpWnDu5 sPZR20ILpzqPykT4lO4HY+6+EQ1lTD90KYGieWdrM6Qy6SdH12Kv57CpvFGbFWHR5Kqg ZjOA== X-Received: by 10.14.220.195 with SMTP id o43mr1071103eep.57.1380200262206; Thu, 26 Sep 2013 05:57:42 -0700 (PDT) Received: from laptop.minsk.domain (m-s.agava.net. [195.222.84.203]) by mx.google.com with ESMTPSA id n48sm3653113eeg.17.1969.12.31.16.00.00 (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 26 Sep 2013 05:57:41 -0700 (PDT) Date: Thu, 26 Sep 2013 15:57:50 +0300 From: "Sergey V. Dyatko" To: Edward Tomasz =?KOI8-R?Q?Napierala?= Subject: Re: panic: make_dev_credv: bad si_name (error=17, si_name=iscsi) Message-ID: <20130926155750.6b1c86fc@laptop.minsk.domain> In-Reply-To: References: <20130924104658.46313090@laptop.minsk.domain> <842AF8F6-E143-494C-B275-F395220732FF@freebsd.org> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit Cc: Sergey Kandaurov , current Current 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: Thu, 26 Sep 2013 12:57:44 -0000 On Wed, 25 Sep 2013 18:06:01 +0200 Edward Tomasz Napierala wrote: > Wiadomo's'c napisana przez Sergey Kandaurov w dniu > 24 wrz 2013, o godz. 14:04: > > On 24 September 2013 15:44, Edward Tomasz Napierala > > wrote: > >> Wiadomo's'c napisana przez Sergey Kandaurov w > >> dniu 24 wrz 2013, o godz. 13:00: > >>> On 24 September 2013 14:40, Sergey Kandaurov > >>> wrote: > >>>> On 24 September 2013 11:46, Sergey V. Dyatko > >>>> wrote: > >>>>> Hi, > >>>>> > >>>>> today I tried to play a bit with new iscsi > >>>>> > >>>>> r255812 isn't fully complete fix? > >>>>> > >>>> [...] > >>>>> run `kldload iscsi_initiator` and got a panic: > >>>> > >>>> Something like this quick'n'dirty should work. > >>>> Compile tested only. > >>>> > >>>> Index: sys/dev/iscsi_initiator/iscsi.c > >>>> =================================================================== > >>>> --- sys/dev/iscsi_initiator/iscsi.c (revision 255841) > >>>> +++ sys/dev/iscsi_initiator/iscsi.c (working copy) > >>>> @@ -715,7 +715,8 @@ > >>>> TUNABLE_INT_FETCH("net.iscsi_initiator.max_pdus", &max_pdus); > >>>> > >>>> isc = malloc(sizeof(struct isc_softc), M_ISCSI, > >>>> M_ZERO|M_WAITOK); > >>>> - isc->dev = make_dev(&iscsi_cdevsw, max_sessions, UID_ROOT, > >>>> GID_WHEEL, 0600, "iscsi"); > >>>> + isc->dev = make_dev_credf(MAKEDEV_CHECKNAME, > >>>> &iscsi_cdevsw, max_sessions, > >>>> + NULL, UID_ROOT, GID_WHEEL, 0600, > >>>> "iscsi"); isc->dev->si_drv1 = isc; > >>>> mtx_init(&isc->isc_mtx, "iscsi-isc", NULL, MTX_DEF); > >>> > >>> Erm, of course it shall be checked against failure. > >> > >> Sure. What do you think about this: > >> > >> Index: sys/dev/iscsi_initiator/iscsi.c > >> =================================================================== > >> --- sys/dev/iscsi_initiator/iscsi.c (revision 255834) > >> +++ sys/dev/iscsi_initiator/iscsi.c (working copy) > >> @@ -715,8 +715,14 @@ iscsi_start(void) > >> TUNABLE_INT_FETCH("net.iscsi_initiator.max_pdus", &max_pdus); > >> > >> isc = malloc(sizeof(struct isc_softc), M_ISCSI, > >> M_ZERO|M_WAITOK); > >> - isc->dev = make_dev(&iscsi_cdevsw, max_sessions, UID_ROOT, > >> GID_WHEEL, 0600, "iscsi"); > >> - isc->dev->si_drv1 = isc; > >> + isc->dev = make_dev_credf(MAKEDEV_CHECKNAME, &iscsi_cdevsw, > >> max_sessions, > >> + NULL, UID_ROOT, GID_WHEEL, 0600, "iscsi"); > >> + if (isc->dev == NULL) { > >> + xdebug("iscsi_initiator: make_dev_credf failed"); > >> + // XXX: don't return; otherwise it would panic on unload > >> + } else { > >> + isc->dev->si_drv1 = isc; > >> + } > >> mtx_init(&isc->isc_mtx, "iscsi-isc", NULL, MTX_DEF); > >> > >> TAILQ_INIT(&isc->isc_sess); > >> > > > > LGTM, except there is different indentation where for function calls > > each new line aligned with the first function argument. > > Committed in a somewhat different form. I've also realized the new > initiator had a similar bug; could you please test both to make sure > everything is right now? Thanks! > looks good (r255873): laptop# kldstat -v | grep -i iscsi laptop# laptop# iscsictl Target name Target addr State laptop# kldstat -v | grep -i iscsi 18 1 0xffffffff8262e000 abb3 iscsi.ko (/boot/kernel/iscsi.ko) 402 iscsi laptop# kldload iscsi_initiator kldload: can't load iscsi_initiator: Exec format error /var/log/messages: Sep 26 15:54:16 laptop kernel: >>> iscsi_start: iscsi_initiator: make_dev_credf failed Sep 26 15:54:16 laptop kernel: module_register_init: MOD_LOAD (iscsi_initiator, 0xffffffff82639000, 0) error 17 laptop# iscsictl -A -h 192.168.9.98 -t iqn.desktop:target0 laptop# kldunload iscsi kldunload: can't unload file: Device busy laptop# iscsictl -Ra laptop# kldunload iscsi laptop# laptop# kldload iscsi_initiator laptop# kldunload iscsi_initiator laptop# kldstat -v | grep -i iscsi laptop# -- wbr, tiger