From 1ac43bf8a63b816e1cbf0b031c5f1495eb4b0eed Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 18 Aug 2013 14:15:14 +0200 Subject: [PATCH] initrd.scripts: use get_device_fstype to execute fstype specific init code This logic replaces the old and buggy setup_btrfsctl code --- defaults/initrd.scripts | 21 +++++++++++++++------ defaults/linuxrc | 3 --- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index dc7e301..5a09a6e 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1383,11 +1383,6 @@ cdupdate() { fi } -setup_btrfsctl() { - # start BTRFS volume detection, if available - [ -x /sbin/btrfs ] && /sbin/btrfs device scan -} - setup_md_device() { local device @@ -1925,6 +1920,16 @@ ensure_initramfs_mounts() { done } +fstype_init() { + local fstype="${1}" + if [ "${fstype}" = "btrfs" ]; then + # start BTRFS volume detection, if available + [ -x /sbin/btrfs ] && /sbin/btrfs device scan + elif [ -z "${fstype}" ]; then + warn_msg "Unable to detect the filesystem type of ${REAL_ROOT}" + fi +} + rootdev_init() { good_msg "Initializing root device..." @@ -2027,7 +2032,11 @@ rootdev_init() { break fi - good_msg "Mounting $REAL_ROOT as root..." + local fstype=$(get_device_fstype "${REAL_ROOT}") + good_msg "Initializing ${REAL_ROOT} if needed, detected fstype: ${fstype}" + fstype_init "${fstype}" + + good_msg "Mounting ${REAL_ROOT} as root..." if [ "${ROOTFSTYPE}" = 'zfs' ] then diff --git a/defaults/linuxrc b/defaults/linuxrc index 7da216d..862f4ec 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -267,9 +267,6 @@ cd / start_iscsi -# Setup btrfs, see bug 303529 -setup_btrfsctl - # Setup md device nodes if they dont exist is_mdev && setup_md_device