[Stgt-devel] PATCH 6 of 6 - Implement READ ELEMENT STATUS op code

Mark Harvey markh794
Sat May 12 05:02:44 CEST 2007


On 5/12/07, Ming Zhang <blackmagic02881 at gmail.com> wrote:
> On Sat, 2007-05-12 at 12:47 +1000, Mark Harvey wrote:
> > On 5/12/07, Ming Zhang <blackmagic02881 at gmail.com> wrote:
> > > On Sat, 2007-05-12 at 12:36 +1000, Mark Harvey wrote:
> > > > On 5/12/07, Ming Zhang <blackmagic02881 at gmail.com> wrote:
> > > > >
> > > > > On Fri, 2007-05-11 at 13:23 +1000, Mark Harvey wrote:
> > > > > > SMC module is now useful enough to return a list of 'barcode' media in
> > > > > > the changer.
> > > > >
> > > > > one potential issue for this command is the data can be larger than 1
> > > > > page if it is a large tl with thousands of elements. pls double check it
> > > > > is handled.
> > > >
> > > > You are correct.
> > > >
> > > > Initially, I attempted to estimate at the amount of memory required
> > > > (based on the number of slots * max record size), however I kept
> > > > getting a core dump and eventually tracked it down to the following
> > > > routine in iscsid.c
> > > >    ======================================
> > > > static void iscsi_free_cmd_task(struct iscsi_task *task)
> > > > {
> > > >         target_cmd_done(&task->scmd);
> > > >
> > > >         list_del(&task->c_hlist);
> > > >         if (task->data) {
> > > >                 if ((unsigned long) task->data != task->addr)
> > > >                         free((void *) (unsigned long) task->addr);
> > > >         }
> > > >         iscsi_free_task(task);
> > > > }
> > > >    ======================================
> > > >
> > > > I keept getting a glibc double free error and was not quite sure where
> > > > to go from here.
> > >
> > > if u like, u can get it implemented in the right way and i can help u on
> > > the crash.
> >
> > Many thanks.
> >
> > I will take you up on this offer.
> >
> > I most likely won't have any 'spare' time to work on this over the
> > weekend but will forward the patch on ASAP.
>
> sure. no problem. hope u patch can be merged soon, patch one by one is
> pretty painful. ;)
>
> >
> > BTW: I sort of check for an overflow. I first check to see it the
> > initiator has allocated more memory then the 'pagesize' and fail the
> > command. This check will not catch the case where the initiator does
> > not know how much space to allocate and makes the initial call just to
> > see what size is returned by the target.
> >
>
> maybe u can have a look at how report luns get done. it has same issue.
>

spc_report_luns() {
[snip]
        data = valloc(pagesize);
[snip]
                if (!(alen -= 8))
                        overflow = 1;
                if (!(rbuflen -= 8)) {
                        fprintf(stderr, "FIXME: too many luns\n");
                        exit(-1);
                }
[snip]

OK this adds another op code that needs to be fixed once a valid
solution is identified...

>
>
> >
> > >
> > >
> > > >
> > > > This was to be the subject of another email I had not written as yet,
> > > > but since you brought it up :)
> > > >
> > > > >
> > > > >
> > > > > >
> > > > > > Can't move them about yet. That will be next op code to be implemented.
> > > > > > _______________________________________________
> > > > > > Stgt-devel mailing list
> > > > > > Stgt-devel at lists.berlios.de
> > > > > > https://lists.berlios.de/mailman/listinfo/stgt-devel
> > > > >
> > > > >
> > >
> > >
>
>



More information about the stgt mailing list