From: John Spray Date: Thu, 26 Jan 2017 16:48:58 +0000 (+0000) Subject: qa: fix race in Mount.open_background X-Git-Tag: v12.0.1~447^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c6d91dd91252e703d08b8ac62ac6a47ee82c0bed;p=ceph.git qa: fix race in Mount.open_background Previously a later remote call could end up executing before the remote python program in open_background had actually got as far as opening the file. Fixes: http://tracker.ceph.com/issues/18661 Signed-off-by: John Spray --- diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index f5d9d73c2fc6..24a89d44a7dc 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -157,7 +157,10 @@ class CephFSMount(object): def open_background(self, basename="background_file"): """ Open a file for writing, then block such that the client - will hold a capability + will hold a capability. + + Don't return until the remote process has got as far as opening + the file, then return the RemoteProcess instance. """ assert(self.is_mounted()) @@ -176,6 +179,12 @@ class CephFSMount(object): rproc = self._run_python(pyscript) self.background_procs.append(rproc) + + # This wait would not be sufficient if the file had already + # existed, but it's simple and in practice users of open_background + # are not using it on existing files. + self.wait_for_visible(basename) + return rproc def wait_for_visible(self, basename="background_file", timeout=30):