From: Xiaoxi Chen Date: Wed, 9 Dec 2015 07:16:59 +0000 (+0800) Subject: init-ceph: do umount when the path exists. X-Git-Tag: v10.0.2~47^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09e21b495ba6e63b71c621d4e2db957b8a923b08;p=ceph.git 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 --- diff --git a/src/init-ceph.in b/src/init-ceph.in index ab4ca26f9c38..5090d731a17f 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