From 4994497f6bb9d640a1315347f251e47eda6cf414 Mon Sep 17 00:00:00 2001 From: Shachar Hasson Date: Sun, 11 Feb 2024 11:20:14 +0200 Subject: [PATCH 1/2] UCT/MM: Replaced error return value with debug log message for shm_unlink failure --- src/uct/sm/mm/posix/mm_posix.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uct/sm/mm/posix/mm_posix.c b/src/uct/sm/mm/posix/mm_posix.c index 73bcf4ef299..59f2c2d3f46 100644 --- a/src/uct/sm/mm/posix/mm_posix.c +++ b/src/uct/sm/mm/posix/mm_posix.c @@ -274,7 +274,8 @@ static ucs_status_t uct_posix_procfs_open(int pid, int peer_fd, int* fd_p) return uct_posix_open_check_result("open", file_path, 0, ret, fd_p); } -static ucs_status_t uct_posix_unlink(uct_mm_md_t *md, uint64_t seg_id) +static ucs_status_t +uct_posix_unlink(uct_mm_md_t *md, uint64_t seg_id, ucs_log_level_t err_level) { uct_posix_md_config_t *posix_config = ucs_derived_of(md->config, uct_posix_md_config_t); @@ -286,7 +287,7 @@ static ucs_status_t uct_posix_unlink(uct_mm_md_t *md, uint64_t seg_id) seg_id & UCT_POSIX_SEG_MMID_MASK); ret = shm_unlink(file_path); if (ret < 0) { - ucs_error("shm_unlink(%s) failed: %m", file_path); + ucs_log(err_level, "shm_unlink(%s) failed: %m", file_path); return UCS_ERR_SHMEM_SEGMENT; } } else { @@ -515,10 +516,7 @@ uct_posix_mem_alloc(uct_md_h tl_md, size_t *length_p, void **address_p, /* If using procfs link instead of mmid, remove the original file and update * seg->seg_id */ if (posix_config->use_proc_link) { - status = uct_posix_unlink(md, seg->seg_id); - if (status != UCS_OK) { - goto err_close; - } + uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_DEBUG); /* Replace mmid by pid+fd. Keep previous SHM_OPEN flag for mkey_pack() */ seg->seg_id = uct_posix_mmid_procfs_pack(fd) | @@ -586,7 +584,7 @@ uct_posix_mem_alloc(uct_md_h tl_md, size_t *length_p, void **address_p, err_close: close(fd); if (!(seg->seg_id & UCT_POSIX_SEG_FLAG_PROCFS)) { - uct_posix_unlink(md, seg->seg_id); + uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_ERROR); } err_free_seg: ucs_free(seg); @@ -612,7 +610,7 @@ static ucs_status_t uct_posix_mem_free(uct_md_h tl_md, uct_mem_h memh) ucs_assert(dummy_pid == getpid()); close(fd); } else { - status = uct_posix_unlink(md, seg->seg_id); + status = uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_ERROR); if (status != UCS_OK) { return status; } From b0283f2afe3d4a78f32129c7d154435972b85443 Mon Sep 17 00:00:00 2001 From: Shachar Hasson Date: Wed, 14 Feb 2024 19:03:46 +0200 Subject: [PATCH 2/2] UCT/MM: minor fix --- src/uct/sm/mm/posix/mm_posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uct/sm/mm/posix/mm_posix.c b/src/uct/sm/mm/posix/mm_posix.c index 59f2c2d3f46..d5201f3ed1a 100644 --- a/src/uct/sm/mm/posix/mm_posix.c +++ b/src/uct/sm/mm/posix/mm_posix.c @@ -516,7 +516,7 @@ uct_posix_mem_alloc(uct_md_h tl_md, size_t *length_p, void **address_p, /* If using procfs link instead of mmid, remove the original file and update * seg->seg_id */ if (posix_config->use_proc_link) { - uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_DEBUG); + uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_DIAG); /* Replace mmid by pid+fd. Keep previous SHM_OPEN flag for mkey_pack() */ seg->seg_id = uct_posix_mmid_procfs_pack(fd) | @@ -584,7 +584,7 @@ uct_posix_mem_alloc(uct_md_h tl_md, size_t *length_p, void **address_p, err_close: close(fd); if (!(seg->seg_id & UCT_POSIX_SEG_FLAG_PROCFS)) { - uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_ERROR); + uct_posix_unlink(md, seg->seg_id, UCS_LOG_LEVEL_WARN); } err_free_seg: ucs_free(seg);