Re: [PATCH] Make sure we still have an elf interpreter after unmounting fs (#598222)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 06/01/2010 08:25 AM, Ales Kozumplik wrote:
Hi,

On 05/31/2010 10:05 PM, Hans de Goede wrote:
When moving to stage2 we rename the initrd /lib to /lib_old and add
a symlink from /lib to /mnt/runtime/lib. When shutting down we unmount
filesystems and then after unmount try to run mdadm to wait for
any Intel BIOS RAID arrays to have their metadata updated that they
were cleanly shutdown to avoid a resync of the entire array on the
next boot.

But at this point /lib is a dangling symlink, so no elf interpreter gets
found (nor libc) and the mdadm call we do fails, leaving the array
unclean.
---
loader/shutdown.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/loader/shutdown.c b/loader/shutdown.c
index 3b481f2..8177399 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -28,6 +28,7 @@
#include<string.h>
#include<sys/reboot.h>
#include<sys/types.h>
+#include<sys/stat.h>
#include<unistd.h>

#include "init.h"
@@ -50,6 +51,7 @@ static void performTerminations(void) {

static void performUnmounts(void) {
int ignore;
+ struct stat st_buf;

printf("disabling swap...\n");
disableSwap();
@@ -57,6 +59,24 @@ static void performUnmounts(void) {
printf("unmounting filesystems...\n");
unmountFilesystems();

+ /* We've lost /mnt/runtime where /lib is a link to put the old
+ /lib back so that our mdadm invocation below works. */
+ if (stat("/lib64",&st_buf) == 0) {
+ if (unlink("/lib64"))
+ perror("unlink /lib64");
+ if (rename("/lib64_old", "/lib64"))
+ perror("rename /lib64_old /lib64");
+ } else {
+ if (unlink("/lib"))
+ perror("unlink /lib");
+ if (rename("/lib_old", "/lib"))
+ perror("rename /lib_old /lib");
+ }
+ if (unlink("/usr"))
+ perror("unlink /usr");
+ if (rename("/usr_old", "/usr"))
+ perror("rename /usr_old /usr");
+
printf("waiting for mdraid sets to become clean...\n");
ignore = system("/sbin/mdadm --wait-clean --scan");

Is this going to be dumped into the terminal also when there's now raid
on the system?

I assume you mean the:
printf("waiting for mdraid sets to become clean...\n");

As the perror's only happen on error (which should never happen).

Yes that always gets printed to the terminal (and that already got
printed before this patch).

Thanks for the review.

Regards,

hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux