[Stgt-devel] iscsi target works, minor fixes
Mike Christie
michaelc
Fri Nov 3 18:43:47 CET 2006
Pete Wyckoff wrote:
> I've been playing with the user-space iscsi target, looking at the
> latest stgt SVN and linux-2.6-target git today. One little fix I
> need in the userspace code is this:
>
> Index: trunk/usr/bd_aio.c
> ===================================================================
> --- 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);
> }
> }
>
> While I don't understand exactly what's going on, this data pointer
> from struct io_event is the correct struct cmd *, and without the
> patch, tgtd segfaults trying to access fields in the (bogus) cmd
> from iocb->data.
What arch are you using? I think I was hitting this same problem but
only on x86_64 for some reason. On x86 it worked ok.
>
> It could be related to the aiopoll-2.6.18-rc4.patch; perhaps that
> was the wrong one to apply? There was one minor reject that was
> easy to fix up. My kernel is v2.6.19-rc4 + the 9 patches in tomo's
> linux-2.6-target.git + aiopoll + other minor patches.
>
> You may want this, but it doesn't change any behavior:
>
> diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c
> index e01f458..6e92b97 100644
> --- a/drivers/scsi/scsi_tgt_lib.c
> +++ b/drivers/scsi/scsi_tgt_lib.c
> @@ -108,7 +108,6 @@ struct scsi_cmnd *scsi_host_get_command(
>
> rq->special = cmd;
> rq->cmd_type = REQ_TYPE_SPECIAL;
> - rq->cmd_flags |= REQ_TYPE_BLOCK_PC;
> rq->end_io_data = tcmd;
>
> bio_list_init(&tcmd->xfer_list);
>
>
> What goes in cmd_flags are bit fields like REQ_SOFTBARRIER. You're
> not supposed to try to put another REQ_TYPE in there. You do want
> SPECIAL, not BLOCK_PC, since you are allocating your own struct
> scsi_cmnd and putting it into rq->special.
>
SPECIAL and BLOCK_PC may not make much difference here because we are
not submitting the request to scsi-ml. It stays in tgt. Maybe to stay
consistent with scsi-ml SPECIAL would be best for now though.
More information about the stgt
mailing list