From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSFo-0003d7-4m for qemu-devel@nongnu.org; Fri, 14 Mar 2014 09:34:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOSFi-0004gI-4X for qemu-devel@nongnu.org; Fri, 14 Mar 2014 09:34:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSFh-0004gE-Sx for qemu-devel@nongnu.org; Fri, 14 Mar 2014 09:34:22 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2EDYKOX029051 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Mar 2014 09:34:21 -0400 Date: Fri, 14 Mar 2014 13:34:19 +0000 From: "Richard W.M. Jones" Message-ID: <20140314133419.GT1346@redhat.com> References: <20140313214814.GC1985@redhat.com> <5322F670.50906@redhat.com> <20140314124216.GQ1346@redhat.com> <5322FA7F.3030802@redhat.com> <20140314132433.GS1346@redhat.com> <532303F8.8010705@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <532303F8.8010705@redhat.com> Subject: Re: [Qemu-devel] fstrim & upstream kernel not working List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Fri, Mar 14, 2014 at 02:28:24PM +0100, Paolo Bonzini wrote: > Il 14/03/2014 14:24, Richard W.M. Jones ha scritto: > >>> Could be a race condition (something going on in the background > >>> between rm and fstrim). > >Not much happens in the libguestfs appliance. There are usually only > >two processes (udev + guestfsd). > > There's also the kernel. The ext4 driver is probably doing > something after rm returns, and hasn't finished yet when you invoke > FITRIM. Yup. libguestfs has exposed a number of places where you can type commands slowly by hand, but running them from a script would fail. Check out the number of places we call 'udevadm --settle' or 'sync' -- each one has been discovered painfully over 5 years. $ git grep -E 'udev_settle|sync_disks' daemon | wc -l 59 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top