From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: [PATCH v1 03/10] libxl: store a copy of vanilla domain configuration when creating domain Date: Fri, 25 Jul 2014 18:14:05 +0100 Message-ID: <21458.36957.843517.433019@mariner.uk.xensource.com> References: <1405002745-5034-1-git-send-email-wei.liu2@citrix.com> <1405002745-5034-4-git-send-email-wei.liu2@citrix.com> <21457.22014.75779.162154@mariner.uk.xensource.com> <20140725105300.GJ28444@zion.uk.xensource.com> <21458.28978.730284.366384@mariner.uk.xensource.com> <20140725154350.GM28444@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140725154350.GM28444@zion.uk.xensource.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: Wei Liu Cc: ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("Re: [PATCH v1 03/10] libxl: store a copy of vanilla domain configuration when creating domain"): > On Fri, Jul 25, 2014 at 04:01:06PM +0100, Ian Jackson wrote: > > During that time various operations would block unreasonably. > > That's a bit unfortunate. But what can we do to close that window? > I think no good will come out if I try to fiddle with domain state > during creation anyway, so locking like this may be acceptable? No, because it might block a management daemon. You're not allowed to hold a lock which libxl operations will block on while doing anything `slow' in the ao sense. Conceivably in a sufficiently complicated system it might even result in deadlock. I think the right answer is for those attempts to fiddle with the domain state to fail. > > Also, I think you mustn't use an fcntl lock across ao operation > > callback chains. fcntl locks do not exclude other threads in the same > > process. > > Then we need both mutex and file lock? Mutex to protect against threads > in the same process while file lock protect against other processes. I think the answer is that you have to not retain the lock for so long. Ian.