From 359277bc5323823a5f86f368f4a3c56ed4fca404 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 2 Apr 2025 21:01:31 +0530 Subject: [PATCH] mgr/vol: handle case where path goes missing for a clone A thread is spawned to get the value of a certain extended attribute to generate the progress statistics for the ongoing clone operations. In case source and/or destination path for a clone operation goes missing, this thread crashes. Instead of crashing, handle this case gracefully. Fixes: https://tracker.ceph.com/issues/71019 Signed-off-by: Rishabh Dave --- src/pybind/mgr/volumes/fs/stats_util.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/volumes/fs/stats_util.py b/src/pybind/mgr/volumes/fs/stats_util.py index 667a5ee29bf..683ffc2df85 100644 --- a/src/pybind/mgr/volumes/fs/stats_util.py +++ b/src/pybind/mgr/volumes/fs/stats_util.py @@ -45,8 +45,19 @@ def get_num_ratio_str(num1, num2): def get_amount_copied(src_path, dst_path, fs_handle): rbytes = 'ceph.dir.rbytes' - size_t = int(fs_handle.getxattr(src_path, rbytes)) - size_c = int(fs_handle.getxattr(dst_path, rbytes)) + try: + size_t = int(fs_handle.getxattr(src_path, rbytes)) + except ObjectNotFound: + log.info(f'get_amount_copied(): source path "{src_path}" went missing, ' + 'couldn\'t run getxattr on it') + return + + try: + size_c = int(fs_handle.getxattr(dst_path, rbytes)) + except ObjectNotFound: + log.info(f'get_amount_copied(): destination path "{dst_path}" went ' + 'missing, couldn\'t run getxattr on it') + return percent: Optional[float] if size_t == 0 or size_c == 0: @@ -59,8 +70,12 @@ def get_amount_copied(src_path, dst_path, fs_handle): def get_percent_copied(src_path, dst_path, fs_handle): - _, _, percent = get_amount_copied(src_path, dst_path, fs_handle) - return percent + retval = get_amount_copied(src_path, dst_path, fs_handle) + if not retval: + return retval + else: + _, _, percent = retval + return percent def get_stats(src_path, dst_path, fs_handle): @@ -294,6 +309,8 @@ class CloneProgressReporter: fs_handle: percent = get_percent_copied(clone.src_path, clone.dst_path, fs_handle) + if not percent: + continue if clone in clones[:total_ongoing_clones]: sum_percent_ongoing += percent if show_onpen_bar: -- 2.39.5