[Stgt-devel] segmentation fault trying to update LUN 0 ...
Richard Sharpe
realrichardsharpe
Fri Jul 25 03:24:27 CEST 2008
On Thu, Jul 24, 2008 at 6:08 PM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
>>> It shouldn't segfault anyway, should it?
>>
>> It seems the segfault is in an error path:
>>
>> ./tgtadm --lld iscsi --op update --mode target --tid 1 --lun 0 -b
>> /root/data/hd_block
>> tgtadm: err no: 4294967274
>> Segmentation fault
>>
>> This is in ipc_mgmt_rsp:
>>
>> if (rsp.err != TGTADM_SUCCESS) {
>> eprintf("err no: %u\n", rsp.err);
>> eprintf("%s\n", tgtadm_emsg[rsp.err]);
>> return EINVAL;
>> }
>>
>> So, looks like tgtd is returning -22 somewhere ... instead of turning
>> it into a positive error no.
>
> Yes, in the iscsi driver code, iscsi_target_update is returning
> -ENOENT and -EINVAL.
>
> These return codes are wrong. It should return a correct
> tgtadm_errno.h return code.
I changed a couple of lines of code in the iscsi target driver, and
that seems to fix the segfault, however, I notice that the fc/fc.c
driver is very different and handled in the kernel.
What I don't know then is whether the in-kernel portions return -errno
codes, or return tgtadm_error.h error codes (which seems unlikely) ...
More information about the stgt
mailing list