chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: make chain of main commands and control commands independent of each other...
[elogind.git]
/
src
/
umount.c
diff --git
a/src/umount.c
b/src/umount.c
index c7f62081d204bc11d4f450d60cc89671dec70a82..4fd6b22ad78620e3585985b0a3f9a19989a827b3 100644
(file)
--- a/
src/umount.c
+++ b/
src/umount.c
@@
-105,7
+105,7
@@
static int mount_points_list_get(MountPoint **head) {
goto finish;
}
goto finish;
}
- if (mount_point_is_api(p)) {
+ if (mount_point_is_api(p)
|| mount_point_ignore(p)
) {
free(p);
continue;
}
free(p);
continue;
}
@@
-223,7
+223,6
@@
static int loopback_list_get(MountPoint **head) {
}
first = udev_enumerate_get_list_entry(e);
}
first = udev_enumerate_get_list_entry(e);
-
udev_list_entry_foreach(item, first) {
MountPoint *lb;
struct udev_device *d;
udev_list_entry_foreach(item, first) {
MountPoint *lb;
struct udev_device *d;
@@
-401,12
+400,13
@@
static int mount_points_list_umount(MountPoint **head, bool *changed) {
assert(head);
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
assert(head);
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
- if (streq(m->path, "/"))
+ if (streq(m->path, "/")) {
+ n_failed++;
continue;
continue;
+ }
/* Trying to umount. Forcing to umount if busy (only for NFS mounts) */
if (umount2(m->path, MNT_FORCE) == 0) {
/* Trying to umount. Forcing to umount if busy (only for NFS mounts) */
if (umount2(m->path, MNT_FORCE) == 0) {
-
if (changed)
*changed = true;
if (changed)
*changed = true;
@@
-466,12
+466,24
@@
static int swap_points_list_off(MountPoint **head, bool *changed) {
static int loopback_points_list_detach(MountPoint **head, bool *changed) {
MountPoint *m, *n;
static int loopback_points_list_detach(MountPoint **head, bool *changed) {
MountPoint *m, *n;
- int n_failed = 0;
+ int n_failed = 0, k;
+ struct stat root_st;
assert(head);
assert(head);
+ k = lstat("/", &root_st);
+
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
int r;
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
int r;
+ struct stat loopback_st;
+
+ if (k >= 0 &&
+ major(root_st.st_dev) != 0 &&
+ lstat(m->path, &loopback_st) >= 0 &&
+ root_st.st_dev == loopback_st.st_rdev) {
+ n_failed ++;
+ continue;
+ }
if ((r = delete_loopback(m->path)) >= 0) {
if ((r = delete_loopback(m->path)) >= 0) {
@@
-490,13
+502,23
@@
static int loopback_points_list_detach(MountPoint **head, bool *changed) {
static int dm_points_list_detach(MountPoint **head, bool *changed) {
MountPoint *m, *n;
static int dm_points_list_detach(MountPoint **head, bool *changed) {
MountPoint *m, *n;
- int n_failed = 0;
+ int n_failed = 0, k;
+ struct stat root_st;
assert(head);
assert(head);
+ k = lstat("/", &root_st);
+
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
int r;
LIST_FOREACH_SAFE(mount_point, m, n, *head) {
int r;
+ if (k >= 0 &&
+ major(root_st.st_dev) != 0 &&
+ root_st.st_dev == m->devnum) {
+ n_failed ++;
+ continue;
+ }
+
if ((r = delete_dm(m->devnum)) >= 0) {
if (r > 0 && changed)
if ((r = delete_dm(m->devnum)) >= 0) {
if (r > 0 && changed)