[Libguestfs] [PATCH] daemon: Run lsof when an umount command fails in umount_all call.

Richard W.M. Jones rjones at redhat.com
Thu Jul 23 15:24:23 UTC 2015


Useful for debugging unmount failures.  Note that we include lsof in
the appliance already.
---
 daemon/mount.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/daemon/mount.c b/daemon/mount.c
index c5b7d89..e139482 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -424,6 +424,10 @@ do_umount_all (void)
     r = command (NULL, &err, str_umount, mounts.argv[i], NULL);
     if (r == -1) {
       reply_with_error ("umount: %s: %s", mounts.argv[i], err);
+      if (verbose) {
+        /* Try running lsof to see what is holding the mountpoint open. */
+        command (NULL, NULL, "lsof", mounts.argv[i], NULL);
+      }
       free_stringslen (mounts.argv, mounts.size);
       return -1;
     }
-- 
2.4.3




More information about the Libguestfs mailing list