From owner-freebsd-xen@freebsd.org Sun Mar 13 08:08:35 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 926D0A92BB1 for ; Sun, 13 Mar 2016 08:08:35 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 38A2B1CA for ; Sun, 13 Mar 2016 08:08:35 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id p65so65607995wmp.1 for ; Sun, 13 Mar 2016 00:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=pbx1NxqxYUBxZ5Gr3P5GUjX+q6grLbWRePjoFUb8f2A=; b=kcd040q05pMEo3vq0Y7JKpv8idFFfbMhmUp06p1abR9iWHV/gnbfEDLBzdubjk0RPD F6ap454l2R1iu4N/FiZpDnsexWKwHtgbgPNHub1l+KebxY2oL+ERH2AhUNKSzXCMF1az 3zkt4HuIobu4QMNCZ/d9S1RwyTIGwueq40tOO03MtpNPAVNLKanNupoPhuYeVADHTUS8 G6mTKEjGFKp6PNgvdPTvijtbOgCt9VP8DJ9SZ8gG9RXp93t/l6ap57Rudfg0XUu9J7Zm rtF3f5qgghinzQtjwVIoMcojxcXp6FGH7qrN6aWTunYFVaLQQaLOG+OJx0XlBrWRujVK bsJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=pbx1NxqxYUBxZ5Gr3P5GUjX+q6grLbWRePjoFUb8f2A=; b=EokH2I/b+ULM4BTetUN630kRpFeQBK1vbtTBHQ439vyyGXZscX//1R/jWcHhpB85Zb 9Vuwi0jKtT2bhuaKGrQnMUQ827m2++3tJ4JrJhtPcn5SM5C1tK8lYcqb9eudwWSr8vgh jhz4IBbgO15LfpnwyvB8nbQCgB/LV+8WuWIvzzQWkhHKAvEMciN1F2IDLtFD+q2IOrwO U9yFYmrX7hC5uQlQbmf+oja/cfH+rRbROYXHHbLdGJCG6m6J/gNM4vK0nS7wU5ACgDbS UzVvsAVYYMfVzfT1h8ApRN4cfVbAw5F1lrypz5beUeVRxbpNEtrCf7qs/ZISA0CfyBJA P6xA== X-Gm-Message-State: AD7BkJL7SktssLSNB5fXA8KpX8R4Nm9UQHaGuhgWo/LM5hmQ/877gxdD5x9dLbc3ffkDLA== X-Received: by 10.28.173.71 with SMTP id w68mr12075730wme.88.1457856513570; Sun, 13 Mar 2016 00:08:33 -0800 (PST) Received: from [192.168.1.111] (139.Red-83-60-211.dynamicIP.rima-tde.net. [83.60.211.139]) by smtp.googlemail.com with ESMTPSA id p191sm11556926wmb.0.2016.03.13.00.08.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 13 Mar 2016 00:08:32 -0800 (PST) Subject: Re: Porting the block-iscsi hotplug script To: FreeBSD XEN References: <553DEB97.5000300@entel.upc.edu> <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?= X-Enigmail-Draft-Status: N1110 Message-ID: <56E51FFF.1010400@gmail.com> Date: Sun, 13 Mar 2016 09:08:31 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Sun, 13 Mar 2016 08:08:35 -0000 El 11/03/16 a les 15:30, Gustau PĂ©rez ha escrit: > > Answering myself again: > I guess the locks need to be released before the hotplug finishes or > there would be stale locks in the system. This is not entirely true. The holds would be dropped when then hotplug script finishes (the fd will be closed by the system when the script finishes). > - I'll ask you something about the advisory locks. Perhaps this > evening if I find some time to spend. > The previous question (in this mail) leaded me to think that perhaps the locking facility is a bit complex. Please correct me if I'm wrong: 1. But we only need to keep track of the lock files created by a hotplug script during its execution, right? : 2. If the script does its job, the hotplug script should release the locks it is holding once its job is done, right? 3. If the domain has two disks defined, the hotplug script would be called two times, right? If that's so, I don't see how during the second execution of the hotplug script the _lockdict array in locking.sh would have the values of the first execution. 4. The hotplug scripts needs to keep track of the lock it holds, that would help the script to release only the lock it holds and not other locks. This is way the _lockdict array is needed. In fact, because the hotplug script should release the locks it has acquired before finishing, I think it would be enough to keep track of the locking files a hotplug script has created (no the fd's) and use the timeout argument of the lockf. If a second domain tries to lock a file, it should loop waiting a fixed amount of time until the lock becomes available. If it becomes available is because: 1. The holder released the lock by calling release_lock 2. Or the holder finished its work a called exit * *Either way the lock would be available. I don't understand why the Linux locking script seems that complex. Perhaps I'm missing something, if anyone sees the point, please let me know. Gustau From owner-freebsd-xen@freebsd.org Tue Mar 15 17:03:03 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 193DFAD2CA7 for ; Tue, 15 Mar 2016 17:03:03 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 A2841106D for ; Tue, 15 Mar 2016 17:03:02 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id p65so153908836wmp.1 for ; Tue, 15 Mar 2016 10:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:cc:to:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=2QLf2xWbqxUm/Cpx3wEK0nrGh4jXvWiUxw3rF+9ni/c=; b=eztq8z06T6G9akjDV2/vYxvrZppdAYVPZjsgmWLdhIog0r0YZ1CiMNrbV+iTqOYReM pvJfMvUewhZfAtltxwaiJGx77cCstdT+q6v/ieE+k5qV1zeT/LdR+OSEQ11NYffdtL2I fO88Z8nBAF6nMvtOV4PswqhwoMydgYpJ8L19mtcgueROcnw24h+xc31FMQUCtRli+yT3 J6cToVetC80ZZ9dSsddglenjAteZwb+iX+ukzCaA2wpPBz+Klo245JtXq6xPsqwz4gsn sADzorPLU6741CX++8vWKT1Ngf7/yuA9O1nbMyIgKjFOAbrqzJc+dcJtL/zQ2Fxx1V/e f5Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:references:cc:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=2QLf2xWbqxUm/Cpx3wEK0nrGh4jXvWiUxw3rF+9ni/c=; b=LTOD9Mae0F+vUhesOzPIhhhbomL9gJUXtJmFix2LWqBlEQWsd/L3GXTQPsNz1KMooe L3kF4eZhCQkeu1x8PZ/QpxJ+cpxNAuYpA3yDBhskLRQTeVGeKD+8M79ZCag0HY/o37sm 7DweYDYrfTqm7v9JaT9fCrPpx0xb6Xl9hUKbCVaOXGh8bak8MjArQ6lACl4KilUy7y1B WycgfX4VZhCA/J3Y6vtEmnwe9qIZkaanKupKlLMckKb82/ma8723Bx0U4q0RI8Yg0Rim 2VYzQDCFXAOWzBTR+ry/c7tBfzb3yIdAYuy/WreEAxF/SytQa02/JS6SmDErre82dwiY VDhw== X-Gm-Message-State: AD7BkJKC6VZ/cTzbGxgZGwToKv6WzMOnOEiCU0PJWD33QYwVFbdaAHNPSUn77vVO9x7SrA== X-Received: by 10.194.47.133 with SMTP id d5mr32684224wjn.87.1458061381097; Tue, 15 Mar 2016 10:03:01 -0700 (PDT) Received: from [10.0.2.151] ([147.83.40.10]) by smtp.googlemail.com with ESMTPSA id gb9sm27914176wjb.26.2016.03.15.10.02.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2016 10:02:59 -0700 (PDT) Subject: Re: Porting the block-iscsi hotplug script 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> To: FreeBSD XEN From: =?UTF-8?Q?Gustau_P=c3=a9rez?= Message-ID: <56E84043.4060602@gmail.com> Date: Tue, 15 Mar 2016 18:02:59 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Tue, 15 Mar 2016 17:03:03 -0000 > 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, finally $WORK gave me a few time to spend and I managed to have something that works with 'sh' (ash). It'd need some comments here and there, but it works. I'll post the scripts somewhere when I got time, or would you prefer diff? Next step would be to deal with HVM domains and qemu, right? Gustau From owner-freebsd-xen@freebsd.org Thu Mar 17 12:48:11 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 E7437AD3B11 for ; Thu, 17 Mar 2016 12:48:11 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (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 7825375D for ; Thu, 17 Mar 2016 12:48:11 +0000 (UTC) (envelope-from gustau.perez@gmail.com) Received: by mail-wm0-x230.google.com with SMTP id l68so24607539wml.0 for ; Thu, 17 Mar 2016 05:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=pNwYuNv+pcQUHUxJ+VKcDgNmKTZk+vB5ju6lO0+w11o=; b=hHVEadeqIKctu4lv6U/M/n/64l8B83fYSDOsTVH4KyhHjUzDS7ymzr9vNEhjNiG89v sfcEiS4n0wWLYuRsBK3xdPlLZ9sf8vHCOXa6AaJyHc+rOrLpOuunjZpa4VGfeeWda30v MXm8ZgJPTdBBR75ZbAQ51T0+ly//M1ITDntQGaYznJEQOX8WJYfAPdLKcqVLsAA3HpWF DNHz8/7BCAW1vKxkS4Rmvgkj/XNhRpS6KbB8Jt5EOOzE/Viatr7sPyIO1ioYMKlYuJ1/ Rj7ugC1bH/b3PLbhq4gItXykF9NdFpBs2RGBdPmCxg54ZxrcWAhs4nFwXtE/Y24sY1Ts SH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=pNwYuNv+pcQUHUxJ+VKcDgNmKTZk+vB5ju6lO0+w11o=; b=g6wc8sEuRh1vBs/gv43H2soC1tOuLXN3LToJplGPnepl67r3/fQZeRQwh72zz5RI/B 7ufKXwMHsi5IXeQGkqZa3rYuhS2elh/uzClcItUx5nyNTCkusWyg4EtKhldNrCCJURJZ gjpZOZApD98mbAQhY/TlbIZR2K9HuJCH8T3ZcRbsn5xx/q9igdnnRfYormqGUK4iedk7 5NiHzdVLJzaDLE0EZ13Cm+FfK8bhW29wVcEhOZt8Sa1AnI8Ev17zZtzrUuoPBDHjatm6 ZDUK4HEYUzUZmpJoC72WPTHoXoulSrwEOSNUAtSEBKZyqaGdNy6B5/na3kUy6vv70SIG IY5Q== X-Gm-Message-State: AD7BkJInGkrjlsyiEHztpKZDwOH5Pv+iUXzh6bMauKKpBtRM5wXLCYONmiRqW7cFmhLxMA== X-Received: by 10.28.50.133 with SMTP id y127mr34961015wmy.4.1458218890122; Thu, 17 Mar 2016 05:48:10 -0700 (PDT) Received: from [10.0.2.151] ([147.83.40.10]) by smtp.googlemail.com with ESMTPSA id w125sm8011187wmw.18.2016.03.17.05.48.09 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2016 05:48:09 -0700 (PDT) Subject: Re: Porting the block-iscsi hotplug script To: FreeBSD XEN References: <553DEB97.5000300@entel.upc.edu> <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> <56E84043.4060602@gmail.com> From: =?UTF-8?Q?Gustau_P=c3=a9rez?= Message-ID: <56EAA788.3020404@gmail.com> Date: Thu, 17 Mar 2016 13:48:08 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <56E84043.4060602@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Thu, 17 Mar 2016 12:48:12 -0000 > finally $WORK gave me a few time to spend and I managed to have > something that works with 'sh' (ash). It'd need some comments here and > there, but it works. I'll post the scripts somewhere when I got time, or > would you prefer diff? > HI Roger, here [1], [2] there are the first versions of the block and locking scripts. Perhaps those scripts need more comments, I don't know. I did not have much time these days, that's why it took me a bit. OTOH I'm not sure if there is any xen programming style I needed to follow. If so let me know. Let me know your thoughts, Gustau [1] http://pastebin.com/FhaQeuG1 [2] http://pastebin.com/ZHWKRg5f