Files
systemd/src/shared/libmount-util.h
Valentin David 6dc68a00cf shutdown: Move busy mounts to not block parent mounts
There is a case that confuses systemd-shutdown: a filesystem has been moved to
a mount point which is part of another filesystem from an image from that
former filesystem. systemd-shutdown cannot unmount any of those two
filesystems. It needs first to move the filesystem containing the image of the
other out of the tree of that image.

Here we move leaf mount points when they are busy so that they do not block
parent mounts. We can only move leafs at each iteration since moving mount
points also move sub mount points which would invalidate we read from
`/proc/self/mountinfo`.
2023-01-11 15:30:42 +01:00

21 lines
589 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* This needs to be after sys/mount.h */
#include <libmount.h>
#include "macro.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_table*, mnt_free_table, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_iter*, mnt_free_iter, NULL);
int libmount_parse(
const char *path,
FILE *source,
struct libmnt_table **ret_table,
struct libmnt_iter **ret_iter);
int libmount_is_leaf(
struct libmnt_table *table,
struct libmnt_fs *fs);