Porting the block-iscsi hotplug script

Gustau Pérez gustau.perez at gmail.com
Fri Mar 11 14:30:57 UTC 2016


>
>    Hi Roger,
>
>    today I got time for that and there's something in
> tools/hotplug/Linux/locking.sh I don't understand. There's an array
> (_lockdict) which seems to be used to keep track of the locks. But I
> have a few concerns:
>
>  1. Where are those values kept? I mean, the _lockdict array seems to be
>     used in _setlockfd() function to search if the lock is already used.
>     Then it searches for the lock and used it if found, If it's not
>     found a new lock is attached, if there's a lock previously freed in
>     a position < ${#_lockdict} that $i position is used. But it remains
>     alive just during the execution of the hotplug script and thus Id
>     say does locks are per process, right?
>  2. This is not related to xen nor xl, but perhaps someone may come with
>     a solution. In sh I think I don't have arrays, does anyone know a
>     solution for that? I mean, perhaps it would be possible to simulate
>     them.
>
>    The second one may be solved by depending on bash, but I think that
> would be overkill IMHO.
>
>    Best,
>
>    Gustau
>
> > .
>

Answering myself:

- I've been to trick ash and do  something like an array by using multiple
variables named like _lockdict$i and another variable holding the size of
the array. if the execution of the scrip only lasts during the boot of a
particular machine I think we would be fine. I guess the locks need to be
released before the hotplug finishes or there would be stale locks in the
system.
- I'll ask you something about the advisory locks. Perhaps this evening if
I find some time to spend.

Thanks,

Gustau


More information about the freebsd-xen mailing list