El 4/03/16 a les 16:54, Roger Pau Monné ha escrit:
> Linux already has some code to do this checking, but this also involves 
> taking a lock in order to make sure there's only one hotplug script 
> performing this check at the same time.
> The Linux function that performs this checking is in:
> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/hotplug/Linux/block;h=2691b56951c9b82094471a141b9e0bed04abb929;hb=HEAD#l40
> And the caller is:
> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/hotplug/Linux/block;h=2691b56951c9b82094471a141b9e0bed04abb929;hb=HEAD#l275
> If you take a look, the call to check_device_sharing is protected with the 
> "block" lock.

   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

   The second one may be solved by depending on bash, but I think that
would be overkill IMHO.



> .

freebsd-xen@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-xen-unsubscr...@freebsd.org"

Reply via email to