Skip to content

Commit

Permalink
Merge pull request #15066 from daos-stack/jeffolivier/google/2.6
Browse files Browse the repository at this point in the history
Merge upstream/release/2.6 into upstream/google/2.6
  • Loading branch information
jolivier23 authored Sep 4, 2024
2 parents c45d0bf + d1a0b75 commit 687aedf
Show file tree
Hide file tree
Showing 74 changed files with 1,497 additions and 1,312 deletions.
5 changes: 2 additions & 3 deletions src/client/dfs/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,14 @@ dfs_obj_get_info(dfs_t *dfs, dfs_obj_t *obj, dfs_obj_info_t *info)
if (dfs->attr.da_dir_oclass_id)
info->doi_dir_oclass_id = dfs->attr.da_dir_oclass_id;
else
rc = daos_obj_get_oclass(dfs->coh, 0, 0, 0,
rc = daos_obj_get_oclass(dfs->coh, DAOS_OT_MULTI_HASHED, 0, 0,
&info->doi_dir_oclass_id);

if (dfs->attr.da_file_oclass_id)
info->doi_file_oclass_id = dfs->attr.da_file_oclass_id;
else
rc = daos_obj_get_oclass(dfs->coh, 0, 0, 0,
rc = daos_obj_get_oclass(dfs->coh, DAOS_OT_ARRAY_BYTE, 0, 0,
&info->doi_file_oclass_id);

if (rc) {
D_ERROR("daos_obj_get_oclass() failed " DF_RC "\n", DP_RC(rc));
return daos_der2errno(rc);
Expand Down
14 changes: 2 additions & 12 deletions src/client/dfuse/il/int_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -2507,15 +2507,9 @@ dfuse_fputs(char *__str, FILE *stream)
if (drop_reference_if_disabled(entry))
goto do_real_fn;

D_ERROR("Unsupported function\n");

entry->fd_err = ENOTSUP;

DISABLE_STREAM(entry, stream);
vector_decref(&fd_table, entry);

errno = ENOTSUP;
return EOF;

do_real_fn:
return __real_fputs(__str, stream);
}
Expand All @@ -2538,13 +2532,9 @@ dfuse_fputws(const wchar_t *ws, FILE *stream)
if (drop_reference_if_disabled(entry))
goto do_real_fn;

entry->fd_err = ENOTSUP;

DISABLE_STREAM(entry, stream);
vector_decref(&fd_table, entry);

errno = ENOTSUP;
return -1;

do_real_fn:
return __real_fputws(ws, stream);
}
Expand Down
12 changes: 6 additions & 6 deletions src/client/dfuse/pil4dfs/dfs_dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct dfs_dcache {
/** Next Garbage collection date */
struct timespec dd_expire_gc;
/** True iff one thread is running the garbage collection */
_Atomic bool dd_running_gc;
atomic_flag dd_running_gc;
/** Destroy a dfs dir-cache */
destroy_fn_t destroy_fn;
/** Return the dir-cahe record of a given location and insert it if needed */
Expand All @@ -95,7 +95,7 @@ struct dcache_rec {
/** Reference counter used to manage memory deallocation */
_Atomic uint32_t dr_ref;
/** True iff this record was deleted from the hash table*/
_Atomic bool dr_deleted;
atomic_flag dr_deleted;
/** Entry in the garbage collector list */
d_list_t dr_entry_gc;
/** True iff this record is not in the garbage collector list */
Expand Down Expand Up @@ -309,7 +309,7 @@ gc_reclaim(dfs_dcache_t *dcache)
dcache->dd_count_gc);

out_unset:
atomic_store_relaxed(&dcache->dd_running_gc, false);
atomic_flag_clear(&dcache->dd_running_gc);
out:
return rc;
}
Expand Down Expand Up @@ -417,7 +417,7 @@ dcache_add_root(dfs_dcache_t *dcache, dfs_obj_t *obj)

rec->dr_obj = obj;
atomic_init(&rec->dr_ref, 0);
atomic_init(&rec->dr_deleted, false);
atomic_flag_clear(&rec->dr_deleted);
memcpy(&rec->dr_key_child_prefix[0], &dcache->dd_key_root_prefix[0], DCACHE_KEY_PREF_SIZE);
memcpy(&rec->dr_key[0], &dcache->dd_key_root_prefix[0], DCACHE_KEY_PREF_SIZE);
rec->dr_key_len = DCACHE_KEY_PREF_SIZE - 1;
Expand Down Expand Up @@ -470,7 +470,7 @@ dcache_create_act(dfs_t *dfs, uint32_t bits, uint32_t rec_timeout, uint32_t gc_p
rc = D_MUTEX_INIT(&dcache_tmp->dd_mutex_gc, NULL);
if (rc != 0)
D_GOTO(error_mutex, daos_errno2der(rc));
atomic_init(&dcache_tmp->dd_running_gc, false);
atomic_flag_clear(&dcache_tmp->dd_running_gc);
D_INIT_LIST_HEAD(&dcache_tmp->dd_head_gc);

rc = d_hash_table_create_inplace(D_HASH_FT_MUTEX | D_HASH_FT_LRU, bits, NULL,
Expand Down Expand Up @@ -571,7 +571,7 @@ dcache_add(dfs_dcache_t *dcache, dcache_rec_t *parent, const char *name, const c
D_GOTO(error, rc = -DER_NOMEM);

atomic_init(&rec_tmp->dr_ref, 1);
atomic_init(&rec_tmp->dr_deleted, false);
atomic_flag_clear(&rec_tmp->dr_deleted);

rc = dfs_lookup_rel(dcache->dd_dfs, parent->dr_obj, name, O_RDWR, &obj, &mode, NULL);
if (rc != 0)
Expand Down
41 changes: 33 additions & 8 deletions src/client/dfuse/pil4dfs/int_dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ static long int page_size;
#define DAOS_INIT_NOT_RUNNING 0
#define DAOS_INIT_RUNNING 1

static _Atomic uint64_t mpi_init_count;

static long int daos_initing;
_Atomic bool d_daos_inited;
static bool daos_debug_inited;
Expand Down Expand Up @@ -467,6 +469,8 @@ static int (*next_posix_fallocate64)(int fd, off64_t offset, off64_t len);
static int (*next_tcgetattr)(int fd, void *termios_p);
/* end NOT supported by DAOS */

static int (*next_mpi_init)(int *argc, char ***argv);

/* to do!! */
/**
* static char * (*org_realpath)(const char *pathname, char *resolved_path);
Expand Down Expand Up @@ -1020,6 +1024,22 @@ consume_low_fd(void)
return rc;
}

int
MPI_Init(int *argc, char ***argv)
{
int rc;

if (next_mpi_init == NULL) {
next_mpi_init = dlsym(RTLD_NEXT, "MPI_Init");
D_ASSERT(next_mpi_init != NULL);
}

atomic_fetch_add_relaxed(&mpi_init_count, 1);
rc = next_mpi_init(argc, argv);
atomic_fetch_add_relaxed(&mpi_init_count, -1);
return rc;
}

/** determine whether a path (both relative and absolute) is on DAOS or not. If yes,
* returns parent object, item name, full path of parent dir, full absolute path, and
* the pointer to struct dfs_mt.
Expand Down Expand Up @@ -1117,6 +1137,15 @@ query_path(const char *szInput, int *is_target_path, struct dcache_rec **parent,
uint64_t status_old = DAOS_INIT_NOT_RUNNING;
bool rc_cmp_swap;

/* Check whether MPI_Init() is running. If yes, pass to the original
* libc functions. Avoid possible zeInit reentrancy/nested call.
*/

if (atomic_load_relaxed(&mpi_init_count) > 0) {
*is_target_path = 0;
goto out_normal;
}

/* daos_init() is expensive to call. We call it only when necessary. */

/* Check whether daos_init() is running. If yes, pass to the original
Expand Down Expand Up @@ -6758,26 +6787,22 @@ init_myhook(void)
dcache_size_bits = DCACHE_SIZE_BITS;
rc = d_getenv_uint32_t("D_IL_DCACHE_SIZE_BITS", &dcache_size_bits);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_SIZE_BITS' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_SIZE_BITS' env variable could not be used");

dcache_rec_timeout = DCACHE_REC_TIMEOUT;
rc = d_getenv_uint32_t("D_IL_DCACHE_REC_TIMEOUT", &dcache_rec_timeout);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_REC_TIMEOUT' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_REC_TIMEOUT' env variable could not be used");

dcache_gc_period = DCACHE_GC_PERIOD;
rc = d_getenv_uint32_t("D_IL_DCACHE_GC_PERIOD", &dcache_gc_period);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_GC_PERIOD' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_GC_PERIOD' env variable could not be used");

dcache_gc_reclaim_max = DCACHE_GC_RECLAIM_MAX;
rc = d_getenv_uint32_t("D_IL_DCACHE_GC_RECLAIM_MAX", &dcache_gc_reclaim_max);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used");
if (dcache_gc_reclaim_max == 0) {
D_WARN("'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used: value == 0.");
dcache_gc_reclaim_max = DCACHE_GC_RECLAIM_MAX;
Expand Down
3 changes: 2 additions & 1 deletion src/container/rpc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -134,6 +134,7 @@ CRT_RPC_DEFINE(cont_tgt_snapshot_notify, DAOS_ISEQ_CONT_TGT_SNAPSHOT_NOTIFY,
DAOS_OSEQ_CONT_TGT_SNAPSHOT_NOTIFY)
CRT_RPC_DEFINE(cont_prop_set, DAOS_ISEQ_CONT_PROP_SET, DAOS_OSEQ_CONT_PROP_SET)
CRT_RPC_DEFINE(cont_prop_set_v8, DAOS_ISEQ_CONT_PROP_SET_V8, DAOS_OSEQ_CONT_PROP_SET)
CRT_RPC_DEFINE(cont_prop_set_bylabel, DAOS_ISEQ_CONT_PROP_SET_BYLABEL, DAOS_OSEQ_CONT_PROP_SET)
CRT_RPC_DEFINE(cont_acl_update, DAOS_ISEQ_CONT_ACL_UPDATE, DAOS_OSEQ_CONT_ACL_UPDATE)
CRT_RPC_DEFINE(cont_acl_update_v8, DAOS_ISEQ_CONT_ACL_UPDATE_V8, DAOS_OSEQ_CONT_ACL_UPDATE)
CRT_RPC_DEFINE(cont_acl_delete, DAOS_ISEQ_CONT_ACL_DELETE, DAOS_OSEQ_CONT_ACL_DELETE)
Expand Down
58 changes: 52 additions & 6 deletions src/container/rpc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -74,7 +74,8 @@
X(CONT_TGT_EPOCH_AGGREGATE, 0, &CQF_cont_tgt_epoch_aggregate, \
ds_cont_tgt_epoch_aggregate_handler, &ds_cont_tgt_epoch_aggregate_co_ops) \
X(CONT_TGT_SNAPSHOT_NOTIFY, 0, &CQF_cont_tgt_snapshot_notify, \
ds_cont_tgt_snapshot_notify_handler, &ds_cont_tgt_snapshot_notify_co_ops)
ds_cont_tgt_snapshot_notify_handler, &ds_cont_tgt_snapshot_notify_co_ops) \
X(CONT_PROP_SET_BYLABEL, 0, &CQF_cont_prop_set_bylabel, ds_cont_set_prop_srv_handler, NULL)

/* Define for RPC enum population below */
#define X(a, ...) a,
Expand Down Expand Up @@ -919,24 +920,43 @@ CRT_RPC_DECLARE(cont_tgt_snapshot_notify, DAOS_ISEQ_CONT_TGT_SNAPSHOT_NOTIFY,
CRT_RPC_DECLARE(cont_prop_set, DAOS_ISEQ_CONT_PROP_SET, DAOS_OSEQ_CONT_PROP_SET)
CRT_RPC_DECLARE(cont_prop_set_v8, DAOS_ISEQ_CONT_PROP_SET_V8, DAOS_OSEQ_CONT_PROP_SET)

#define DAOS_ISEQ_CONT_PROP_SET_BYLABEL /* input fields */ \
DAOS_ISEQ_CONT_PROP_SET_V8 \
((d_const_string_t) (cpsi_label) CRT_VAR)

CRT_RPC_DECLARE(cont_prop_set_bylabel, DAOS_ISEQ_CONT_PROP_SET_BYLABEL, DAOS_OSEQ_CONT_PROP_SET)

/* clang-format on */

static inline void
cont_prop_set_in_get_data(crt_rpc_t *rpc, crt_opcode_t opc, int cont_proto_ver,
daos_prop_t **cpsi_propp, uuid_t *cpsi_pool_uuidp)
daos_prop_t **cpsi_propp, uuid_t *cpsi_pool_uuidp, uuid_t *cpsi_co_uuidp,
const char **cont_label)
{
void *in = crt_req_get(rpc);

if (cont_proto_ver >= CONT_PROTO_VER_WITH_SVC_OP_KEY) {
if (opc == CONT_PROP_SET_BYLABEL) {
*cpsi_propp = ((struct cont_prop_set_bylabel_in *)in)->cpsi_prop;
if (cpsi_pool_uuidp)
uuid_copy(*cpsi_pool_uuidp,
((struct cont_prop_set_bylabel_in *)in)->cpsi_pool_uuid);
if (cont_label != NULL)
*cont_label = ((struct cont_prop_set_bylabel_in *)in)->cpsi_label;
} else if (cont_proto_ver >= CONT_PROTO_VER_WITH_SVC_OP_KEY) {
*cpsi_propp = ((struct cont_prop_set_v8_in *)in)->cpsi_prop;
if (cpsi_pool_uuidp)
uuid_copy(*cpsi_pool_uuidp,
((struct cont_prop_set_v8_in *)in)->cpsi_pool_uuid);
if (cpsi_co_uuidp)
uuid_copy(*cpsi_co_uuidp,
((struct cont_prop_set_v8_in *)in)->cpsi_op.ci_uuid);
} else {
*cpsi_propp = ((struct cont_prop_set_in *)in)->cpsi_prop;
if (cpsi_pool_uuidp)
uuid_copy(*cpsi_pool_uuidp,
((struct cont_prop_set_in *)in)->cpsi_pool_uuid);
if (cpsi_co_uuidp)
uuid_copy(*cpsi_co_uuidp, ((struct cont_prop_set_in *)in)->cpsi_op.ci_uuid);
}
}

Expand All @@ -946,16 +966,42 @@ cont_prop_set_in_set_data(crt_rpc_t *rpc, crt_opcode_t opc, int cont_proto_ver,
{
void *in = crt_req_get(rpc);

if (cont_proto_ver >= CONT_PROTO_VER_WITH_SVC_OP_KEY) {
if (opc == CONT_PROP_SET_BYLABEL) {
((struct cont_prop_set_bylabel_in *)in)->cpsi_prop = cpsi_prop;
uuid_copy(((struct cont_prop_set_bylabel_in *)in)->cpsi_pool_uuid, cpsi_pool_uuid);
} else if (cont_proto_ver >= CONT_PROTO_VER_WITH_SVC_OP_KEY) {
((struct cont_prop_set_v8_in *)in)->cpsi_prop = cpsi_prop;
uuid_copy(((struct cont_prop_set_v8_in *)in)->cpsi_pool_uuid, cpsi_pool_uuid);

} else {
((struct cont_prop_set_in *)in)->cpsi_prop = cpsi_prop;
uuid_copy(((struct cont_prop_set_in *)in)->cpsi_pool_uuid, cpsi_pool_uuid);
}
}

static inline void
cont_prop_set_in_set_cont_uuid(crt_rpc_t *rpc, crt_opcode_t opc, int cont_proto_ver,
uuid_t cont_uuid)
{
void *in = crt_req_get(rpc);

D_ASSERT(opc == CONT_PROP_SET);
if (cont_proto_ver >= CONT_PROTO_VER_WITH_SVC_OP_KEY)
uuid_copy(((struct cont_prop_set_v8_in *)in)->cpsi_op.ci_uuid, cont_uuid);
else
uuid_copy(((struct cont_prop_set_in *)in)->cpsi_op.ci_uuid, cont_uuid);
}

static inline void
cont_prop_set_bylabel_in_set_label(crt_rpc_t *rpc, crt_opcode_t opc, int cont_proto_ver,
const char *label)
{
void *in = crt_req_get(rpc);

D_ASSERT(opc == CONT_PROP_SET_BYLABEL);
/* NB: prop set by label is on the server side only - no version variants */
((struct cont_prop_set_bylabel_in *)in)->cpsi_label = label;
}

/* clang-format off */

#define DAOS_ISEQ_CONT_ACL_UPDATE /* input fields */ \
Expand Down
Loading

0 comments on commit 687aedf

Please sign in to comment.