Received: from eggs.gnu.org ([2001:4830:134:3::10]:57712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxdt-00060L-8U for qemu-devel@nongnu.org; Mon, 09 May 2016 22:43:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azxdq-0001tA-Gl for qemu-devel@nongnu.org; Mon, 09 May 2016 22:43:24 -0400 Date: Tue, 10 May 2016 10:43:15 +0800 From: Fam Zheng Message-ID: <20160510024315.GB1207@ad.usersys.redhat.com> References: <1461848266-32119-1-git-send-email-famz@redhat.com> <1461848266-32119-9-git-send-email-famz@redhat.com> <20160504134632.GA28935@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160504134632.GA28935@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: qemu-devel@nongnu.org, Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Markus Armbruster , Max Reitz , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com, John Snow On Wed, 05/04 14:46, Richard W.M. Jones wrote: > On Thu, Apr 28, 2016 at 08:57:27PM +0800, Fam Zheng wrote: > > They are wrappers of POSIX fcntl file locking, with the additional > > interception of open/close (through qemu_open and qemu_close) to offer a > > better semantics that preserves the locks across multiple life cycles of > > different fds on the same file. The reason to make this semantics > > change over the fcntl locks is to make the API cleaner for QEMU > > subsystems. > > > > More precisely, we remove this "feature" of fcntl lock: > > > > If a process closes any file descriptor referring to a file, then > > all of the process's locks on that file are released, regardless of > > the file descriptor(s) on which the locks were obtained. > > > > as long as the fd is always open/closed through qemu_open and > > qemu_close. > > > + ret = qemu_lock_do(fd, start, len, readonly ? F_RDLCK : F_WRLCK); > > + if (ret == -1) { > > + return -errno; > > + } > > It still appears this patch would break libguestfs's valid use case. > > How about addressing what Dan wrote here: > > https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg02927.html OK. It means we then don't lock ro images at all. Fair enough and I will respin. Fam