[Stgt-devel] iscsi target works, minor fixes
Pete Wyckoff
pw
Sat Nov 4 22:43:19 CET 2006
fujita.tomonori at lab.ntt.co.jp wrote on Sat, 04 Nov 2006 01:04 +0900:
> From: Pete Wyckoff <pw at osc.edu>
> Subject: [Stgt-devel] iscsi target works, minor fixes
> Date: Thu, 2 Nov 2006 19:45:48 -0500
>
> > --- trunk/usr/bd_aio.c (revision 609)
> > +++ trunk/usr/bd_aio.c (working copy)
> > @@ -74,8 +74,8 @@ static void aio_event_handler(int fd, in
> >
> > for (i = 0; i < nr; i++) {
> > iocb = bai->events[i].obj;
> > - dprintf("%p\n", iocb->data);
> > - target_cmd_io_done(iocb->data, 0);
> > + dprintf("%p\n", bai->events[i].data);
> > + target_cmd_io_done(bai->events[i].data, 0);
> > }
> > }
>
> Is iocb->data bogus? It means that io_event->obj does not refer to
> the appropriate iocb. I have no idea why.
Here's some logging from the latest stgt, with the extra %p in the debug
message:
tgtd: iscsi_scsi_cmd_rx_start(1189) 1 28 4096 1 c
tgtd: iscsi_scsi_cmd_rx_start(1198) 0x538010
tgtd: iscsi_task_queue(1122) c c 1
tgtd: target_cmd_queue(287) 28 0
tgtd: scsi_cmd_perform(477) 28 4096
tgtd: bd_aio_cmd_submit(159) 8 0 4096 538010 0 0x7fffe26e8510 0x534940
tgtd: target_cmd_queue(307) c 28 538010 0 4096 0 1
tgtd: aio_event_handler(83) 0x7fffe26e8510 0x7fffe26e8520
It's pretty clear to me that bai->events[i].data is what you should
be using. See the kernel's io_submit_one, where req->ki_user_data
is set, then how it is returned to the user via event->data in
aio_complete. True, bai->events[i].obj gets set to the address of
the iocb passed in, but as you used an iocb on the stack in
bd_aio_cmd_submit, that cannot be trusted.
-- Pete
More information about the stgt
mailing list