[systemd-devel] [PATCH 1/3] umount: umount, until all umounts failed

harald at redhat.com harald at redhat.com
Thu May 5 03:47:59 PDT 2011


From: Harald Hoyer <harald at redhat.com>

---
 src/umount.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/umount.c b/src/umount.c
index 3d328e0..31e91ec 100644
--- a/src/umount.c
+++ b/src/umount.c
@@ -551,6 +551,8 @@ static int dm_points_list_detach(MountPoint **head, bool *changed) {
 
 int umount_all(bool *changed) {
         int r;
+        bool umount_changed;
+
         LIST_HEAD(MountPoint, mp_list_head);
 
         LIST_HEAD_INIT(MountPoint, mp_list_head);
@@ -559,7 +561,13 @@ int umount_all(bool *changed) {
         if (r < 0)
                 goto end;
 
-        r = mount_points_list_umount(&mp_list_head, changed);
+        /* retry umount, until nothing can be umounted anymore */
+        do {
+                umount_changed = false;
+                r = mount_points_list_umount(&mp_list_head, &umount_changed);
+                if (umount_changed)
+                        *changed = true;
+        } while(umount_changed);
         if (r <= 0)
                 goto end;
 
-- 
1.7.3.4



More information about the systemd-devel mailing list