Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,19 @@ void unmount_tmpfs(void)
}
}

void unmount_regular(void)
int unmount_regular(void)
{
const struct mntent *mnt;
FILE *fp = NULL;
int rc = 0;

while ((mnt = iterator("/proc/mounts", &fp))) {
if (!unmount(mnt->mnt_dir))
rc = unmount(mnt->mnt_dir);
if (!rc)
iterator_end(&fp); /* Restart iteration */
}

return !!rc;
}

/**
Expand Down
8 changes: 5 additions & 3 deletions src/sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static struct sigmap {

void mdadm_wait(void);
void unmount_tmpfs(void);
void unmount_regular(void);
int unmount_regular(void);

static void fs_swapoff(void)
{
Expand Down Expand Up @@ -302,6 +302,7 @@ void do_shutdown(shutop_t op)
struct sched_param sched_param = { .sched_priority = 99 };
int in_cont = in_container();
int signo = SIGTERM;
int rc;

if (SHUTDOWN_DEBUG) cprintf("do_shutdown: entered, op=%d\n", op);

Expand Down Expand Up @@ -377,12 +378,13 @@ void do_shutdown(shutop_t op)
}

/* Unmount any tmpfs before unmounting swap ... */
print(0, "Unmounting filesystems ...");
print(-1, "Unmounting filesystems ...");
unmount_tmpfs();
fs_swapoff();

/* ... 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!
Expand Down
Loading