From: Rishabh Dave Date: Wed, 2 Apr 2025 15:31:31 +0000 (+0530) Subject: mgr/vol: handle case where path goes missing for a clone X-Git-Tag: v20.1.0~29^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9dd72e8f283ac3b15411a94e430121bc6b4e2ec2;p=ceph.git 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 (cherry picked from commit 359277bc5323823a5f86f368f4a3c56ed4fca404) --- diff --git a/src/pybind/mgr/volumes/fs/stats_util.py b/src/pybind/mgr/volumes/fs/stats_util.py index 667a5ee29bf1..683ffc2df85e 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: