From ae4cf50d72adebc6df338ef54ec5f2755ad73b8f Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 10 Nov 2023 17:18:13 -0500 Subject: [PATCH] 20846: Avoid deadlock in unmount-and-replace race. refs #20846 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/fuse/arvados_fuse/unmount.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/fuse/arvados_fuse/unmount.py b/services/fuse/arvados_fuse/unmount.py index 12d047a8f3..144c582ddc 100644 --- a/services/fuse/arvados_fuse/unmount.py +++ b/services/fuse/arvados_fuse/unmount.py @@ -154,6 +154,16 @@ def unmount(path, subtype=None, timeout=10, recursive=False): path = os.path.realpath(path) continue elif not mounted: + if was_mounted: + # This appears to avoid a race condition where we + # return control to the caller after running + # "fusermount -u -z" (see below), the caller (e.g., + # arv-mount --replace) immediately tries to attach a + # new fuse mount at the same mount point, the + # lazy-unmount process unmounts that _new_ mount while + # it is being initialized, and the setup code waits + # forever for the new mount to be initialized. + time.sleep(1) return was_mounted if attempted: -- 2.30.2