summaryrefslogtreecommitdiff
path: root/src/basic/mount-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/mount-util.c')
-rw-r--r--src/basic/mount-util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index d04e7492e5..29997b1ce7 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -506,3 +506,24 @@ bool fstype_is_network(const char *fstype) {
return nulstr_contains(table, fstype);
}
+
+int repeat_unmount(const char *path, int flags) {
+ bool done = false;
+
+ assert(path);
+
+ /* If there are multiple mounts on a mount point, this
+ * removes them all */
+
+ for (;;) {
+ if (umount2(path, flags) < 0) {
+
+ if (errno == EINVAL)
+ return done;
+
+ return -errno;
+ }
+
+ done = true;
+ }
+}