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

Edward Tomasz Napierała trasz at freebsd.org
Tue Sep 24 11:44:13 UTC 2013


Wiadomość 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)
>> @@ -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);



More information about the freebsd-current mailing list