FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 05-31-2010, 08:05 PM
Hans de Goede
 
Default Make sure we still have an elf interpreter after unmounting fs (#598222)

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...
");
disableSwap();
@@ -57,6 +59,24 @@ static void performUnmounts(void) {
printf("unmounting filesystems...
");
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...
");
ignore = system("/sbin/mdadm --wait-clean --scan");
}
--
1.7.0.1

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

Thread Tools




All times are GMT. The time now is 03:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org