From owner-freebsd-xen@freebsd.org Fri Mar 11 14:30:57 2016 Return-Path: Delivered-To: freebsd-xen@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A9EEACC10F for ; Fri, 11 Mar 2016 14:30:57 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1F201999 for ; Fri, 11 Mar 2016 14:30:56 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: by mail-ig0-x231.google.com with SMTP id ig19so12880478igb.0 for ; Fri, 11 Mar 2016 06:30:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bKCwryO+Dcv8dbnXQrmbgsQmAaBSRX5Be75qGA0PYgI=; b=af+r2cWRm6rcAtDpFXqLBIKI5l+/pRDBDr5GV4ickMgVrtAtoPxraVfcP3vP5lANDS 4XR2YnG47OXArxt6hSrRovMtMWEjndQDMnbMBB64QhElSlonQF1tADTx2wbL5XiLIzep ic7OxxLMSDINMWS+8t+2+FdcJNoDts0LJ9KaqhFh51CZHvM1BYFToK7V9XM5SMQm+48c I7EvL47jMMs3aRL3YrgYM/onWtiwq8kk2O35lHLSS2fwmkU8qFREf+vgDem1e4ZcD4Qn Nu21zxVqy3k7JQrjXO+dHvevc+0s7GY91ATo1YkQ5gn8vpf3lMxu3VxsbvFEG6BgDFSx E4GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bKCwryO+Dcv8dbnXQrmbgsQmAaBSRX5Be75qGA0PYgI=; b=jUQFm7MPE/jllKr7hP/CuzaN00sG5EkK6W5a5vjmQVchvv4LRdASfZ4qwbkFNXb5xu V77DaOtbhFmtMosD++2088P3Lk+CYKiSIHby/y/Gm/fHeI6MQPh2L4mEv/A1PPXqSqaW /FWnFj1tT2uyqZuHWCMBNGKBIufhOuRloT2AURKjNGhJqQtGTEwNmZpV1RJarFT9hgDq d0HSAR2BDPZfhZhE3d5h2pVAsY/Zw5C7UmltPv5How6Ri9z3JtYqF7Ht9Wpamn3EGO7q WhhXFUhIDe7BCxi/jM1g2ua0tRdZfniyg4SForgJySj2S25Qir6Ch07oHi48aajVOZUC Mi2w== X-Gm-Message-State: AD7BkJI9rBgeH6QZ3yypiuMhOStyocFZd4MzxQ3WcLknqnYn0DkanVo2UhbEvQAvLqjRqafHLFvUAzEXj6kP0A== X-Received: by 10.50.164.229 with SMTP id yt5mr3822202igb.43.1457706656324; Fri, 11 Mar 2016 06:30:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.10.198 with HTTP; Fri, 11 Mar 2016 06:30:16 -0800 (PST) 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> <56D97762.7000908@gmail.com> <56E16604.2040007@gmail.com> From: =?UTF-8?Q?Gustau_P=C3=A9rez?= Date: Fri, 11 Mar 2016 15:30:16 +0100 Message-ID: Subject: Re: Porting the block-iscsi hotplug script To: FreeBSD XEN Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2016 14:30:57 -0000 > > 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