mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00:00
mount: report unmount failures
Return a failure status from unmount_regular() when filesystems remain mounted, and use it to report the final shutdown unmount result. Signed-off-by: Anees Rehman <anees.rehman@atlascopco.com>
This commit is contained in:
1 parent
f29a3db86c
commit
70a44d3860
2 files changed
+11
-5
No files matched your search
+6
-2
@@ -121,15 +121,19 @@ void unmount_tmpfs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmount_regular(void)
|
int unmount_regular(void)
|
||||||
{
|
{
|
||||||
const struct mntent *mnt;
|
const struct mntent *mnt;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
while ((mnt = iterator("/proc/mounts", &fp))) {
|
while ((mnt = iterator("/proc/mounts", &fp))) {
|
||||||
if (!unmount(mnt->mnt_dir))
|
rc = unmount(mnt->mnt_dir);
|
||||||
|
if (!rc)
|
||||||
iterator_end(&fp); /* Restart iteration */
|
iterator_end(&fp); /* Restart iteration */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return !!rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ static struct sigmap {
|
|||||||
|
|
||||||
void mdadm_wait(void);
|
void mdadm_wait(void);
|
||||||
void unmount_tmpfs(void);
|
void unmount_tmpfs(void);
|
||||||
void unmount_regular(void);
|
int unmount_regular(void);
|
||||||
|
|
||||||
static void fs_swapoff(void)
|
static void fs_swapoff(void)
|
||||||
{
|
{
|
||||||
@@ -302,6 +302,7 @@ void do_shutdown(shutop_t op)
|
|||||||
struct sched_param sched_param = { .sched_priority = 99 };
|
struct sched_param sched_param = { .sched_priority = 99 };
|
||||||
int in_cont = in_container();
|
int in_cont = in_container();
|
||||||
int signo = SIGTERM;
|
int signo = SIGTERM;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (SHUTDOWN_DEBUG) cprintf("do_shutdown: entered, op=%d\n", op);
|
if (SHUTDOWN_DEBUG) cprintf("do_shutdown: entered, op=%d\n", op);
|
||||||
|
|
||||||
@@ -372,12 +373,13 @@ void do_shutdown(shutop_t op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Unmount any tmpfs before unmounting swap ... */
|
/* Unmount any tmpfs before unmounting swap ... */
|
||||||
print(0, "Unmounting filesystems ...");
|
print(-1, "Unmounting filesystems ...");
|
||||||
unmount_tmpfs();
|
unmount_tmpfs();
|
||||||
fs_swapoff();
|
fs_swapoff();
|
||||||
|
|
||||||
/* ... unmount remaining regular file systems. */
|
/* ... unmount remaining regular file systems. */
|
||||||
unmount_regular();
|
rc = unmount_regular();
|
||||||
|
print(rc, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We sit on / so we must remount it ro, try all the things!
|
* We sit on / so we must remount it ro, try all the things!
|
||||||
|
|||||||
Reference in new issue
Block a user