summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-13 21:56:23 -0700
committerSage Weil <sage@inktank.com>2013-06-14 14:04:54 -0700
commite5ffe0d2484eb6cbcefcaeb5d52020b1130871a5 (patch)
treea10d97ce07e6b6b1788d73ef63eb23980eb1a4d4
parentf3234c147e083f2904178994bc85de3d082e2836 (diff)
downloadceph-e5ffe0d2484eb6cbcefcaeb5d52020b1130871a5.tar.gz
ceph-disk: do not use mount --move (or --bind)
The kernel does not let you mount --move when the parent mount is shared (see, e.g., https://bugzilla.redhat.com/show_bug.cgi?id=917008 for another person this also confused). We can't use --bind either since that (on RHEL at least) screws up /etc/mtab so that the final result looks like /var/lib/ceph/tmp/mnt.HNHoXU /var/lib/ceph/osd/ceph-0 none rw,bind 0 0 Instead, mount the original dev in the final location and then umount from the old location. Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-xsrc/ceph-disk21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ceph-disk b/src/ceph-disk
index 1d1a1501e79..127d809902d 100755
--- a/src/ceph-disk
+++ b/src/ceph-disk
@@ -1248,6 +1248,7 @@ def auth_key(
def move_mount(
+ dev,
path,
cluster,
osd_id,
@@ -1259,15 +1260,30 @@ def move_mount(
'{cluster}-{osd_id}'.format(cluster=cluster, osd_id=osd_id),
)
maybe_mkdir(osd_data)
+
+ # we really want to mount --move, but that is not supported when
+ # the parent mount is shared, as it is by default on RH, Fedora,
+ # and probably others. Also, --bind doesn't properly manipulate
+ # /etc/mtab, which *still* isn't a symlink to /proc/mounts despite
+ # this being 2013. Instead, mount the original device at the final
+ # location.
subprocess.check_call(
args=[
'/bin/mount',
- '--move',
'--',
- path,
+ dev,
osd_data,
],
)
+ subprocess.check_call(
+ args=[
+ '/bin/umount',
+ '-l', # lazy, in case someone else is peeking at the
+ # wrong moment
+ '--',
+ path,
+ ],
+ )
def start_daemon(
@@ -1405,6 +1421,7 @@ def mount_activate(
raise Error('another %s osd.%s already mounted in position (old/different cluster instance?); unmounting ours.' % (cluster, osd_id))
else:
move_mount(
+ dev=dev,
path=path,
cluster=cluster,
osd_id=osd_id,