Skip to content

Commit

Permalink
Merge pull request #9670 from shasson5/unlink
Browse files Browse the repository at this point in the history
UCT/MM: Replaced error value with debug log message for shm_unlink
  • Loading branch information
yosefe authored Feb 15, 2024
2 parents 8cf7aad + b0283f2 commit 0a96f85
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/uct/sm/mm/posix/mm_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down Expand Up @@ -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_DIAG);

/* Replace mmid by pid+fd. Keep previous SHM_OPEN flag for mkey_pack() */
seg->seg_id = uct_posix_mmid_procfs_pack(fd) |
Expand Down Expand Up @@ -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_WARN);
}
err_free_seg:
ucs_free(seg);
Expand All @@ -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;
}
Expand Down

0 comments on commit 0a96f85

Please sign in to comment.