diff options
author | Sage Weil <sage@inktank.com> | 2013-06-13 21:56:23 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-14 14:10:00 -0700 |
commit | dfbd20104e01ce22c7e501f748b2bf13382ee7f6 (patch) | |
tree | 9f365e156b57475429e83e48b5da14c93a9f95a7 | |
parent | 98a990d796e71c62fa64c13230a18a4a40aedcdf (diff) | |
download | ceph-dfbd20104e01ce22c7e501f748b2bf13382ee7f6.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>
(cherry picked from commit e5ffe0d2484eb6cbcefcaeb5d52020b1130871a5)
-rwxr-xr-x | src/ceph-disk | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ceph-disk b/src/ceph-disk index 6d844ad34c8..c070aee8c34 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, |