From: Ian Campbell Subject: Re: [PATCH 08/19] libxc: suspend: Fix suspend event channel locking Date: Thu, 13 Mar 2014 16:47:55 +0000 Message-ID: <1394729275.16364.13.camel@kazak.uk.xensource.com> References: <1393945016-1417-1-git-send-email-ian.jackson@eu.citrix.com> <1393945016-1417-9-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1393945016-1417-9-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Shriram Rajagopalan , xen-devel@lists.xensource.com, Lai Jiangshan , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, 2014-03-04 at 14:56 +0000, Ian Jackson wrote: > Use fcntl F_SETLK, rather than writing our pid into a "lock" file. > That way if we crash we don't leave the lockfile lying about. Callers > now need to keep the fd for our lockfile. (We don't use flock because > we don't want anyone who inherits this fd across fork to end up with a > handle onto the lock.) > > While we are here: > * Move the lockfile to /var/run/xen There isn't some autoconf'y path we should use is there? SUBSYS_DIR, localstatedir etc? Probably we don't really use those elsewhere so it is consistent to use /var directly here too. > * De-duplicate the calculation of the pathname > * Compute the buffer size for the pathname so that it will definitely > not overrun (and use the computed value everywhere) > * Fix various error handling bugs > > Signed-off-by: Ian Jackson > CC: Stefano Stabellini Acked-by: Ian Campbell > CC: Shriram Rajagopalan > --- > tools/libxc/xc_suspend.c | 159 +++++++++++++------- > tools/libxc/xenguest.h | 16 +- > tools/libxl/libxl_dom.c | 6 +- > tools/libxl/libxl_internal.h | 1 + > tools/misc/xen-hptool.c | 19 ++- > tools/python/xen/lowlevel/checkpoint/checkpoint.h | 2 +- > .../python/xen/lowlevel/checkpoint/libcheckpoint.c | 7 +- > tools/xcutils/xc_save.c | 8 +- > 8 files changed, 149 insertions(+), 69 deletions(-)