]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: do umount when the path exists. 6866/head
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Wed, 9 Dec 2015 07:16:59 +0000 (15:16 +0800)
committerXiaoxi Chen <xiaoxi.chen@intel.com>
Sun, 13 Dec 2015 08:17:56 +0000 (16:17 +0800)
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 <xiaoxi.chen@intel.com>
src/init-ceph.in

index ab4ca26f9c3821c4cd2a440fd15b971dbcce504c..5090d731a17f41dfc0f009a62e685941bd239f3d 100755 (executable)
@@ -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