From: Ian Jackson Subject: Re: [PATCH] xenconsole: Ensure exclusive access to console using locks Date: Fri, 24 Jul 2015 14:35:44 +0100 Message-ID: <21938.16176.972242.374529@mariner.uk.xensource.com> References: <1437738262.24746.79.camel@citrix.com> <1437742310-14193-1-git-send-email-martin@lucina.net> <1437743460.24746.88.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZId8i-00082l-4n for xen-devel@lists.xenproject.org; Fri, 24 Jul 2015 13:35:52 +0000 In-Reply-To: <1437743460.24746.88.camel@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 Campbell Cc: xen-devel@lists.xenproject.org, Martin Lucina , Wei Liu , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH] xenconsole: Ensure exclusive access to console using locks"): > I think the answer is to either not remove the lockfile That is a bit messy (although not entirely wrong). > or to do so _before_ dropping the lock, which makes the unlink > itself the effective unlock point. This is necessary but not sufficient. With only that change: A open flock unlink close B open flock .o{ I have the lock } C open flock .o{ I have the lock } B is mistaken because it olds an fd onto an unlinked file. Ian.