Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2016 15:30:16 +0100
From:      =?UTF-8?Q?Gustau_P=C3=A9rez?= <gustau.perez@gmail.com>
To:        FreeBSD XEN <freebsd-xen@freebsd.org>
Subject:   Re: Porting the block-iscsi hotplug script
Message-ID:  <CAOJdW3Rd1GOuEHh6B8jJXP968bBbemPuTCPAeS3bMyDWfz8WcA@mail.gmail.com>
In-Reply-To: <56E16604.2040007@gmail.com>
References:  <553DEB97.5000300@entel.upc.edu> <555EF542.3090002@citrix.com> <555F9B3F.1000600@entel.upc.edu> <55602512.1090702@citrix.com> <56C6FA2F.8040900@gmail.com> <56CAC8CB.8030107@gmail.com> <56CADEDA.4050007@citrix.com> <56CB0057.1060509@gmail.com> <56CB041E.1020009@citrix.com> <56CB2D90.5080809@gmail.com> <56CB34BA.6060809@citrix.com> <56CC24BD.6050609@gmail.com> <56CC32E5.5010101@citrix.com> <56CC7637.3080408@gmail.com> <56CF5668.6090605@citrix.com> <56D0091F.80408@gmail.com> <56D02863.7040100@citrix.com> <56D03D95.9090509@gmail.com> <56D04E5F.8070901@citrix.com> <56D42A28.8050701@gmail.com> <56D434FC.8030905@citrix.com> <56D57110.2060406@gmail.com> <56D587D8.6030702@citrix.com> <56D590EA.609@gmail.com> <56D591BA.4020303@gmail.com> <56D5929F.7040001@citrix.com> <56D5C722.3080205@gmail.com> <56D6B68D.8080809@citrix.com> <56D7FEFE.9050000@gmail.com> <alpine.OSX.2.20.1603041055250.20397@mac> <56D97762.7000908@gmail.com> <alpine.OSX.2.20.1603041647160.22025@mac> <56E16604.2040007@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>
>    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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOJdW3Rd1GOuEHh6B8jJXP968bBbemPuTCPAeS3bMyDWfz8WcA>