patch-2.1.42 linux/fs/super.c

Next file: linux/include/asm-alpha/unistd.h
Previous file: linux/fs/nfs/nfsroot.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.41/linux/fs/super.c linux/fs/super.c
@@ -938,11 +938,7 @@
 	return retval;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void do_mount_root(void)
-#else
 __initfunc(static void do_mount_root(void))
-#endif
 {
 	struct file_system_type * fs_type;
 	struct super_block * sb;
@@ -1060,7 +1056,9 @@
 
 #ifdef CONFIG_BLK_DEV_INITRD
 
-int change_root(kdev_t new_root_dev,const char *put_old)
+extern int initmem_freed;
+
+__initfunc(static int do_change_root(kdev_t new_root_dev,const char *put_old))
 {
 	kdev_t old_root_dev;
 	struct vfsmount *vfsmnt;
@@ -1112,6 +1110,15 @@
 	}
 	inode->i_mount = old_root;
 	return 0;
+}
+
+int change_root(kdev_t new_root_dev,const char *put_old)
+{
+	if (initmem_freed) {
+		printk (KERN_CRIT "Initmem has been already freed. Staying in initrd\n");
+		return -EBUSY;
+	}
+	return do_change_root(new_root_dev, put_old);
 }
 
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov