summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-02-12 03:11:04 -0500
committerKotresh HR <khiremat@redhat.com>2018-02-22 05:40:35 +0000
commite4ca0b3df379c553e220f929f0203175bd536b61 (patch)
treeb4e673999ea45bf1a5370015e19d5241bf4aa965
parent961370d995400b68afe520207593b8cc59846448 (diff)
geo-rep: Remove lazy umount and use mount namespaces
Lazy umounting the master volume by worker causes issues with rsync's usage of getcwd. Henc removing the lazy umount and using private mount namespace for the same. On the slave, the lazy umount is retained as we can't use private namespace in non root geo-rep setup. Change-Id: I403375c02cb3cc7d257a5f72bbdb5118b4c8779a BUG: 1546129 Signed-off-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r--geo-replication/syncdaemon/monitor.py8
-rw-r--r--geo-replication/syncdaemon/rconf.py3
-rw-r--r--geo-replication/syncdaemon/resource.py19
-rw-r--r--geo-replication/syncdaemon/syncdutils.py14
-rw-r--r--glusterfs.spec.in4
5 files changed, 33 insertions, 15 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index 257d34a743b..0d1423aca9f 100644
--- a/geo-replication/syncdaemon/monitor.py
+++ b/geo-replication/syncdaemon/monitor.py
@@ -221,7 +221,13 @@ class Monitor(object):
if rconf.args.debug:
args_to_worker.append("--debug")
- os.execv(sys.executable, args_to_worker)
+ access_mount = gconf.get("access-mount")
+ if access_mount:
+ os.execv(sys.executable, args_to_worker)
+ else:
+ unshare_cmd = ['unshare', '-m', '--propagation', 'private']
+ cmd = unshare_cmd + args_to_worker
+ os.execvp("unshare", cmd)
cpids.add(cpid)
agents.add(apid)
diff --git a/geo-replication/syncdaemon/rconf.py b/geo-replication/syncdaemon/rconf.py
index 1b8f333c0c8..ccac62c63a8 100644
--- a/geo-replication/syncdaemon/rconf.py
+++ b/geo-replication/syncdaemon/rconf.py
@@ -30,5 +30,8 @@ class RConf(object):
mgmt_lock_fd = None
args = None
turns = 0
+ mountbroker = False
+ mount_point = None
+ mbr_umount_cmd = []
rconf = RConf()
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index 2d48a28c145..8f17e00fb2d 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -38,7 +38,7 @@ from syncdutils import get_changelog_log_level, get_rsync_version
from syncdutils import CHANGELOG_AGENT_CLIENT_VERSION
from syncdutils import GX_GFID_CANONICAL_LEN
from gsyncdstatus import GeorepStatus
-from syncdutils import mntpt_list, lf, Popen, sup, Volinfo
+from syncdutils import lf, Popen, sup, Volinfo
from syncdutils import Xattr, matching_disk_gfid, get_gfid_from_mnt
@@ -804,6 +804,7 @@ class Mounter(object):
def __init__(self, params):
self.params = params
self.mntpt = None
+ self.umount_cmd = []
@classmethod
def get_glusterprog(cls):
@@ -838,10 +839,6 @@ class Mounter(object):
change into the mount, and lazy unmount the
filesystem.
"""
- access_mount = gconf.get("access-mount")
- if rconf.args.subcmd == "slave":
- access_mount = gconf.get("slave-access-mount")
-
mpi, mpo = os.pipe()
mh = Popen.fork()
if mh:
@@ -903,13 +900,15 @@ class Mounter(object):
assert(mntdata[-1] == '\0')
mntpt = mntdata[:-1]
assert(mntpt)
- if mounted and not access_mount:
+ if mounted and rconf.args.subcmd == "slave" \
+ and not gconf.get("slave-access-mount"):
po = self.umount_l(mntpt)
po.terminate_geterr(fail_on_err=False)
if po.returncode != 0:
po.errlog()
rv = po.returncode
- if not access_mount:
+ if rconf.args.subcmd == "slave" \
+ and not gconf.get("slave-access-mount"):
self.cleanup_mntpt(mntpt)
except:
logging.exception('mount cleanup failure:')
@@ -931,7 +930,7 @@ class DirectMounter(Mounter):
def make_mount_argv(self, label=None):
self.mntpt = tempfile.mkdtemp(prefix='gsyncd-aux-mount-')
- mntpt_list.append(self.mntpt)
+ rconf.mount_point = self.mntpt
return [self.get_glusterprog()] + \
['--' + p for p in self.params] + [self.mntpt]
@@ -964,6 +963,10 @@ class MountbrokerMounter(Mounter):
def handle_mounter(self, po):
self.mntpt = po.stdout.readline()[:-1]
+ rconf.mount_point = self.mntpt
+ rconf.mountbroker = True
+ self.umount_cmd = self.make_cli_argv() + ['umount']
+ rconf.mbr_umount_cmd = self.umount_cmd
po.stdout.close()
sup(self, po)
if po.returncode != 0:
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
index e546f558265..1e40ff56858 100644
--- a/geo-replication/syncdaemon/syncdutils.py
+++ b/geo-replication/syncdaemon/syncdutils.py
@@ -68,9 +68,6 @@ PERCENTAGE_ESCAPE_CHAR = "%25"
final_lock = Lock()
-mntpt_list = []
-
-
def sup(x, *a, **kw):
"""a rubyesque "super" for python ;)
@@ -254,12 +251,16 @@ def finalize(*args, **kwargs):
shutil.rmtree(rconf.ssh_ctl_dir, onerror=handle_rm_error)
""" Unmount if not done """
- for mnt in mntpt_list:
- p0 = subprocess.Popen(["umount", "-l", mnt], stderr=subprocess.PIPE)
+ if rconf.mount_point:
+ if rconf.mountbroker:
+ umount_cmd = rconf.mbr_umount_cmd + [rconf.mount_point, 'lazy']
+ else:
+ umount_cmd = ['umount', '-l', rconf.mount_point]
+ p0 = subprocess.Popen(umount_cmd, stderr=subprocess.PIPE)
_, errdata = p0.communicate()
if p0.returncode == 0:
try:
- os.rmdir(mnt)
+ os.rmdir(rconf.mount_point)
except OSError:
pass
else:
@@ -279,6 +280,7 @@ def log_raise_exception(excont):
Translate some weird sounding but well understood exceptions
into human-friendly lingo
"""
+
is_filelog = False
for h in logging.getLogger().handlers:
fno = getattr(getattr(h, 'stream', None), 'fileno', None)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 1c3c51b6513..c147dd9bc2d 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -441,6 +441,7 @@ Requires: python2
Requires: python-prettytable
Requires: python2-gluster = %{version}-%{release}
Requires: rsync
+Requires: util-linux
%description geo-replication
GlusterFS is a distributed file-system capable of scaling to several
@@ -1463,6 +1464,9 @@ exit 0
%endif
%changelog
+* Thu Feb 22 2018 Kotresh HR <khiremat@redhat.com>
+- Added util-linux as dependency to georeplication rpm (#1544382)
+
* Thu Feb 1 2018 Niels de Vos <ndevos@redhat.com>
- Add '--without server' option to facilitate el6 builds (#1074947)