.I /proc/self/mountinfo
entries. The filesystem
must be specified by mountpoint path; a recursive unmount by device name (or UUID)
-is unsupported.
+is unsupported. Since version 2.37 it umounts also all over-mounted filesystems
+(more filesystems on the same mountpoint).
.TP
.BR \-r , " \-\-read\-only"
When an unmount fails, try to remount the filesystem read-only.
static int umount_do_recurse(struct libmnt_context *cxt,
struct libmnt_table *tb, struct libmnt_fs *fs)
{
- struct libmnt_fs *child;
+ struct libmnt_fs *child, *over = NULL;
struct libmnt_iter *itr = mnt_new_iter(MNT_ITER_BACKWARD);
int rc;
if (!itr)
err(MNT_EX_SYSERR, _("libmount iterator allocation failed"));
+ /* first try overmount */
+ if (mnt_table_over_fs(tb, fs, &over) == 0 && over) {
+ rc = umount_do_recurse(cxt, tb, over);
+ if (rc != MNT_EX_SUCCESS)
+ goto done;
+ }
+
/* umount all children */
for (;;) {
rc = mnt_table_next_child_fs(tb, itr, fs, &child);
} else if (rc == 1)
break; /* no more children */
+ if (over && child == over)
+ continue;
+
rc = umount_do_recurse(cxt, tb, child);
if (rc != MNT_EX_SUCCESS)
goto done;