Re: panic: make_dev_credv: bad si_name (error=17, si_name=iscsi)

From: Sergey V. Dyatko <sergey.dyatko_at_gmail.com>
Date: Thu, 26 Sep 2013 15:57:50 +0300
On Wed, 25 Sep 2013 18:06:01 +0200
Edward Tomasz Napierala <trasz_at_freebsd.org> wrote:

> Wiadomo's'c napisana przez Sergey Kandaurov <pluknet_at_gmail.com> w dniu
> 24 wrz 2013, o godz. 14:04:
> > On 24 September 2013 15:44, Edward Tomasz Napierala
> > <trasz_at_freebsd.org> wrote:
> >> Wiadomo's'c napisana przez Sergey Kandaurov <pluknet_at_gmail.com> w
> >> dniu 24 wrz 2013, o godz. 13:00:
> >>> On 24 September 2013 14:40, Sergey Kandaurov <pluknet_at_gmail.com>
> >>> wrote:
> >>>> On 24 September 2013 11:46, Sergey V. Dyatko
> >>>> <sergey.dyatko_at_gmail.com> 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)
> >>>> _at__at_ -715,7 +715,8 _at__at_
> >>>>     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)
> >> _at__at_ -715,8 +715,14 _at__at_ 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
Received on Thu Sep 26 2013 - 10:57:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:42 UTC