init: make initrd/initramfs decompression failure a KERN_EMERG event
authorH. Peter Anvin <hpa@linux.intel.com>
Wed, 14 Jan 2009 19:28:35 +0000 (11:28 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 14 Jan 2009 19:28:35 +0000 (11:28 -0800)
Impact: More consistent behaviour, avoid policy in the kernel

Upgrade/downgrade initrd/initramfs decompression failure from
inconsistently a panic or a KERN_ALERT message to a KERN_EMERG event.
It is, however, possible do design a system which can recover from
this (using the kernel builtin code and/or the internal initramfs),
which means this is policy, not a technical necessity.

A good way to handle this would be to have a panic-level=X option, to
force a panic on a printk above a certain level.  That is a separate
patch, however.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
init/do_mounts_rd.c
init/initramfs.c

index 91d0cfca507108303f4f12fb0fb67bde30644fc8..027a402708de6c7fa505f989b6151f5ea5bf1935 100644 (file)
@@ -83,7 +83,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
                printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n",
                       compress_name, start_block);
                if (!*decompressor)
                printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n",
                       compress_name, start_block);
                if (!*decompressor)
-                       printk(KERN_CRIT "RAMDISK: %s decompressor not configured!\n",
+                       printk(KERN_EMERG
+                              "RAMDISK: %s decompressor not configured!\n",
                               compress_name);
                nblocks = 0;
                goto done;
                               compress_name);
                nblocks = 0;
                goto done;
index 9a7290ec81875dc6dcc526e139b836ce5a27da80..7dcde7ea660306801958857fdce54c7ee56bce9b 100644 (file)
@@ -528,7 +528,7 @@ static int __init populate_rootfs(void)
        char *err = unpack_to_rootfs(__initramfs_start,
                         __initramfs_end - __initramfs_start, 0);
        if (err)
        char *err = unpack_to_rootfs(__initramfs_start,
                         __initramfs_end - __initramfs_start, 0);
        if (err)
-               panic(err);
+               panic(err);     /* Failed to decompress INTERNAL initramfs */
        if (initrd_start) {
 #ifdef CONFIG_BLK_DEV_RAM
                int fd;
        if (initrd_start) {
 #ifdef CONFIG_BLK_DEV_RAM
                int fd;
@@ -554,9 +554,12 @@ static int __init populate_rootfs(void)
                printk(KERN_INFO "Unpacking initramfs...");
                err = unpack_to_rootfs((char *)initrd_start,
                        initrd_end - initrd_start, 0);
                printk(KERN_INFO "Unpacking initramfs...");
                err = unpack_to_rootfs((char *)initrd_start,
                        initrd_end - initrd_start, 0);
-               if (err)
-                       panic(err);
-               printk(" done\n");
+               if (err) {
+                       printk(" failed!\n");
+                       printk(KERN_EMERG "%s\n", err);
+               } else {
+                       printk(" done\n");
+               }
                free_initrd();
 #endif
        }
                free_initrd();
 #endif
        }