From fb33abaee6e1a4d7e795899819476a3012e0706b Mon Sep 17 00:00:00 2001 From: Andrzej Jackowski Date: Fri, 15 May 2026 10:16:12 +0200 Subject: [PATCH] test: storage: retry fusermount3 unmount on teardown After stopping scylla server processes, the FUSE daemon (fuse2fs) may still be processing file handle closures. An immediate fusermount3 -u can fail with 'device busy', causing spurious test failures on teardown. Retry the unmount up to 10 times with 0.5s delay between attempts, and capture stderr for diagnostics. Fixes: SCYLLADB-2066 Closes scylladb/scylladb#29920 (cherry picked from commit 61e5ec98882b3be2cd960b65ed6ef8a2eecad3ae) Closes scylladb/scylladb#29930 --- test/cluster/storage/conftest.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/cluster/storage/conftest.py b/test/cluster/storage/conftest.py index eb6026475e..8dbe43fda2 100644 --- a/test/cluster/storage/conftest.py +++ b/test/cluster/storage/conftest.py @@ -5,10 +5,12 @@ # SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1 # import pytest +import logging import os import pathlib import shutil import subprocess +import time import uuid from typing import Callable @@ -19,6 +21,8 @@ from test.cluster.conftest import PHASE_REPORT_KEY from test.pylib.manager_client import ManagerClient from test.pylib.util import gather_safely +logger = logging.getLogger(__name__) + @pytest.fixture(scope="function") def volumes_factory(pytestconfig, build_mode, request): @@ -64,7 +68,15 @@ def volumes_factory(pytestconfig, build_mode, request): shutil.copytree(volume.mount, base.parent.parent / f"scylla-{hash}-{id}", ignore=shutil.ignore_patterns('commitlog*', 'lost+found*')) shutil.copyfile(volume.log, base.parent.parent / f"scylla-{hash}-{id}.log") - subprocess.run(["fusermount3", "-u", volume.mount], check=True) + retries = 10 + for attempt in range(retries): + result = subprocess.run(["fusermount3", "-u", volume.mount], capture_output=True, text=True) + if result.returncode == 0: + break + logger.warning("fusermount3 -u attempt %d/%d failed: %s", attempt + 1, retries, result.stderr.strip()) + if attempt + 1 == retries: + raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr) + time.sleep(0.5) os.unlink(volume.img)