Skip to content

Commit

Permalink
qa: fix race in Mount.open_background
Browse files Browse the repository at this point in the history
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 <john.spray@redhat.com>
  • Loading branch information
John Spray committed Jan 26, 2017
1 parent 4755086 commit c6d91dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion qa/tasks/cephfs/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ def open_no_data(self, basename):
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())

Expand All @@ -176,6 +179,12 @@ def open_background(self, basename="background_file"):

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):
Expand Down

0 comments on commit c6d91dd

Please sign in to comment.