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