From 09e21b495ba6e63b71c621d4e2db957b8a923b08 Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Wed, 9 Dec 2015 15:16:59 +0800 Subject: [PATCH] init-ceph: do umount when the path exists. If the specified mount point is in use, umount it instead of skipping mounting the fs. In previous code , if we forgot that we already mount something unrelated to *this ceph osd * to the particular mount point, we will skip the mount and finally get an error complaining superblock not matching OSD ID. umount & remount is better because 1. If the wrong FS not in use, we can get the right FS we want and make ceph boot smoothly. 2. If the wrong FS is in use, we will get EBUSY on umount, which seems explain the situation more clearly than superblock mismatch. Signed-off-by: Xiaoxi Chen --- src/init-ceph.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index ab4ca26f9c382..5090d731a17f4 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -379,10 +379,10 @@ for name in $what; do do_root_cmd_okfail "mkdir -p $fs_path" if [ "$fs_type" = "btrfs" ]; then echo Mounting Btrfs on $host:$fs_path - do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts || mount -t btrfs $fs_opt $first_dev $fs_path" + do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path" else echo Mounting $fs_type on $host:$fs_path - do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts || mount -t $fs_type $fs_opt $first_dev $fs_path" + do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path" fi if [ "$ERR" != "0" ]; then EXIT_STATUS=$ERR -- 2.47.3