Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into tanabarr/control-au…
Browse files Browse the repository at this point in the history
…to-faulty-config

Features: control
Required-githooks: true

Signed-off-by: Tom Nabarro <tom.nabarro@intel.com>
  • Loading branch information
tanabarr committed Jan 21, 2024
2 parents cb4b3ae + 16ecc93 commit 9e2efb6
Show file tree
Hide file tree
Showing 26 changed files with 420 additions and 246 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rpm-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ env:
# build is done on the lowest version and test on the highest with a "sanity test"
# stage done on all versions in the list ecept the highest
EL8_BUILD_VERSION: 8.6
EL8_VERSION: 8
EL8_VERSION: 8.8
EL9_BUILD_VERSION: 9
EL9_VERSION: 9
LEAP15_VERSION: 15.4
LEAP15_VERSION: 15.5

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion ci/functional/test_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_cluster() {
FIRST_NODE=${first_node} \
TEST_RPMS=${TEST_RPMS} \
NODELIST=${tnodes} \
BUILD_URL=\"$BUILD_URL\" \
BUILD_URL=\"${BUILD_URL:-Unknown in GHA}\" \
STAGE_NAME=\"$STAGE_NAME\" \
$(cat ci/functional/test_main_prep_node.sh)"
}
Expand Down
4 changes: 2 additions & 2 deletions src/cart/crt_iv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3508,8 +3508,8 @@ crt_iv_update_internal(crt_iv_namespace_t ivns, uint32_t class_id,

D_GOTO(exit, rc);
} else {
DL_CDEBUG(rc == -DER_NONEXIST || rc == -DER_NOTLEADER, DLOG_INFO, DLOG_ERR, rc,
"ivo_on_update failed");
DL_CDEBUG(rc == -DER_NONEXIST || rc == -DER_NOTLEADER || rc == -DER_BUSY,
DLOG_INFO, DLOG_ERR, rc, "ivo_on_update failed");

update_comp_cb(ivns, class_id, iv_key, NULL,
iv_value, rc, cb_arg);
Expand Down
150 changes: 105 additions & 45 deletions src/client/dfs/dfs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2018-2023 Intel Corporation.
* (C) Copyright 2018-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -3416,13 +3416,10 @@ lookup_rel_path(dfs_t *dfs, dfs_obj_t *root, const char *path, int flags,
lookup_rel_path_loop:

/*
* Open the directory object one level up.
* Since fetch_entry does not support ".",
* we can't support ".." as the last entry,
* nor can we support "../.." because we don't
* have parent.parent_oid and parent.mode.
* For now, represent this partial state with
* parent_fully_valid.
* Open the directory object one level up. Since fetch_entry does not support ".",
* we can't support ".." as the last entry, nor can we support "../.." because we
* don't have parent.parent_oid and parent.mode. For now, represent this partial
* state with parent_fully_valid.
*/
parent_fully_valid = true;
if (strcmp(token, "..") == 0) {
Expand Down Expand Up @@ -3508,15 +3505,23 @@ lookup_rel_path(dfs_t *dfs, dfs_obj_t *root, const char *path, int flags,
}

if (stbuf) {
daos_size_t size;
daos_array_stbuf_t array_stbuf = {0};

rc = daos_array_get_size(obj->oh, DAOS_TX_NONE, &size, NULL);
rc = daos_array_stat(obj->oh, DAOS_TX_NONE, &array_stbuf, NULL);
if (rc) {
daos_array_close(obj->oh, NULL);
D_GOTO(err_obj, rc = daos_der2errno(rc));
}
stbuf->st_size = size;

stbuf->st_size = array_stbuf.st_size;
stbuf->st_blocks = (stbuf->st_size + (1 << 9) - 1) >> 9;

rc = update_stbuf_times(entry, array_stbuf.st_max_epoch, stbuf,
NULL);
if (rc) {
daos_array_close(obj->oh, NULL);
D_GOTO(err_obj, rc);
}
}
break;
}
Expand Down Expand Up @@ -3617,31 +3622,78 @@ lookup_rel_path(dfs_t *dfs, dfs_obj_t *root, const char *path, int flags,
}

obj->d.chunk_size = entry.chunk_size;
obj->d.oclass = entry.oclass;
if (stbuf)
stbuf->st_size = sizeof(entry);

obj->d.oclass = entry.oclass;
oid_cp(&parent.oid, obj->oid);
oid_cp(&parent.parent_oid, obj->parent_oid);
parent.oh = obj->oh;
parent.mode = entry.mode;

if (stbuf) {
daos_epoch_t ep;

rc = daos_obj_query_max_epoch(obj->oh, DAOS_TX_NONE, &ep, NULL);
if (rc) {
daos_obj_close(obj->oh, NULL);
D_GOTO(err_obj, rc = daos_der2errno(rc));
}

rc = update_stbuf_times(entry, ep, stbuf, NULL);
if (rc) {
daos_obj_close(obj->oh, NULL);
D_GOTO(err_obj, rc = daos_der2errno(rc));
}
stbuf->st_size = sizeof(entry);
}
}

if (mode)
*mode = obj->mode;

if (stbuf) {
if (is_root) {
daos_epoch_t ep;

/** refresh possibly stale root stbuf */
rc = fetch_entry(dfs->layout_v, dfs->super_oh, DAOS_TX_NONE, "/", 1, false,
&exists, &entry, 0, NULL, NULL, NULL);
if (rc) {
D_ERROR("fetch_entry() failed: %d (%s)\n", rc, strerror(rc));
D_GOTO(err_obj, rc);
}

if (!exists || !S_ISDIR(entry.mode)) {
/** something really bad happened! */
D_ERROR("Root object corrupted!");
D_GOTO(err_obj, rc = EIO);
}

if (mode)
*mode = entry.mode;
dfs->root_stbuf.st_mode = entry.mode;
dfs->root_stbuf.st_uid = entry.uid;
dfs->root_stbuf.st_gid = entry.gid;

rc = daos_obj_query_max_epoch(dfs->root.oh, DAOS_TX_NONE, &ep, NULL);
if (rc)
D_GOTO(err_obj, rc = daos_der2errno(rc));

/** object was updated since creation */
rc = update_stbuf_times(entry, ep, &dfs->root_stbuf, NULL);
if (rc)
D_GOTO(err_obj, rc);
if (tspec_gt(dfs->root_stbuf.st_ctim, dfs->root_stbuf.st_mtim)) {
dfs->root_stbuf.st_atim.tv_sec = entry.ctime;
dfs->root_stbuf.st_atim.tv_nsec = entry.ctime_nano;
} else {
dfs->root_stbuf.st_atim.tv_sec = entry.mtime;
dfs->root_stbuf.st_atim.tv_nsec = entry.mtime_nano;
}
memcpy(stbuf, &dfs->root_stbuf, sizeof(struct stat));
} else {
stbuf->st_nlink = 1;
stbuf->st_mode = obj->mode;
stbuf->st_uid = entry.uid;
stbuf->st_gid = entry.gid;
stbuf->st_mtim.tv_sec = entry.mtime;
stbuf->st_mtim.tv_nsec = entry.mtime_nano;
stbuf->st_ctim.tv_sec = entry.ctime;
stbuf->st_ctim.tv_nsec = entry.ctime_nano;
stbuf->st_gid = entry.gid;
if (tspec_gt(stbuf->st_ctim, stbuf->st_mtim)) {
stbuf->st_atim.tv_sec = entry.ctime;
stbuf->st_atim.tv_nsec = entry.ctime_nano;
Expand Down Expand Up @@ -5408,11 +5460,12 @@ dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)
bool set_size = false;
bool set_mtime = false;
bool set_ctime = false;
int i = 0;
size_t len;
int rc;
int i = 0, hlc_recx_idx = 0;
size_t len;
uint64_t obj_hlc = 0;
struct stat rstat = {};
daos_array_stbuf_t array_stbuf = {0};
int rc;

if (dfs == NULL || !dfs->mounted)
return EINVAL;
Expand Down Expand Up @@ -5509,6 +5562,10 @@ dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)
d_iov_set(&sg_iovs[i], &obj_hlc, sizeof(uint64_t));
recxs[i].rx_idx = HLC_IDX;
recxs[i].rx_nr = sizeof(uint64_t);
if (flags & DFS_SET_ATTR_SIZE) {
/** we need to update this again after the set size */
hlc_recx_idx = i;
}
i++;

set_mtime = true;
Expand Down Expand Up @@ -5558,38 +5615,41 @@ dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)
rstat.st_blocks = (stbuf->st_size + (1 << 9) - 1) >> 9;
rstat.st_size = stbuf->st_size;

/* mtime and ctime need to be updated too only if not set earlier */
if (!set_mtime || !set_ctime) {
daos_array_stbuf_t array_stbuf = {0};
/**
* if mtime is set, we need to to just update the hlc on the entry. if mtime and/or
* ctime were not set, we need to update the stat buf returned. both cases require
* an array stat for the hlc.
*/
/** TODO - need an array API to just stat the max epoch without size */
rc = daos_array_stat(obj->oh, th, &array_stbuf, NULL);
if (rc)
D_GOTO(out_obj, rc = daos_der2errno(rc));

/** TODO - need an array API to just stat the max epoch without size */
rc = daos_array_stat(obj->oh, th, &array_stbuf, NULL);
if (rc)
if (!set_mtime) {
rc = d_hlc2timespec(array_stbuf.st_max_epoch, &rstat.st_mtim);
if (rc) {
D_ERROR("d_hlc2timespec() failed " DF_RC "\n", DP_RC(rc));
D_GOTO(out_obj, rc = daos_der2errno(rc));

if (!set_mtime) {
rc = d_hlc2timespec(array_stbuf.st_max_epoch, &rstat.st_mtim);
if (rc) {
D_ERROR("d_hlc2timespec() failed "DF_RC"\n", DP_RC(rc));
D_GOTO(out_obj, rc = daos_der2errno(rc));
}
}
} else {
D_ASSERT(hlc_recx_idx > 0);
D_ASSERT(recxs[hlc_recx_idx].rx_idx == HLC_IDX);
d_iov_set(&sg_iovs[hlc_recx_idx], &array_stbuf.st_max_epoch,
sizeof(uint64_t));
}

if (!set_ctime) {
rc = d_hlc2timespec(array_stbuf.st_max_epoch, &rstat.st_ctim);
if (rc) {
D_ERROR("d_hlc2timespec() failed "DF_RC"\n", DP_RC(rc));
D_GOTO(out_obj, rc = daos_der2errno(rc));
}
if (!set_ctime) {
rc = d_hlc2timespec(array_stbuf.st_max_epoch, &rstat.st_ctim);
if (rc) {
D_ERROR("d_hlc2timespec() failed " DF_RC "\n", DP_RC(rc));
D_GOTO(out_obj, rc = daos_der2errno(rc));
}
}
}

iod.iod_nr = i;

if (i == 0)
D_GOTO(out_stat, rc = 0);

sgl.sg_nr = i;
sgl.sg_nr_out = 0;
sgl.sg_iovs = &sg_iovs[0];
Expand Down Expand Up @@ -6686,7 +6746,7 @@ oit_mark_cb(dfs_t *dfs, dfs_obj_t *parent, const char name[], void *args)
}

/** open the entry name and get the oid */
rc = dfs_lookup_rel(dfs, parent, name, O_RDONLY, &obj, NULL, NULL);
rc = dfs_lookup_rel(dfs, parent, name, O_RDONLY | O_NOFOLLOW, &obj, NULL, NULL);
if (rc) {
D_ERROR("dfs_lookup_rel() of %s failed: %d\n", name, rc);
return rc;
Expand Down
16 changes: 8 additions & 8 deletions src/client/dfs/duns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,14 +1331,6 @@ duns_destroy_path(daos_handle_t poh, const char *path)
return rc;
}

/** Destroy the container */
rc = daos_cont_destroy(poh, dattr.da_cont, 1, NULL);
if (rc) {
D_ERROR("Failed to destroy container (%d)\n", rc);
/** recreate the link ? */
return daos_der2errno(rc);
}

if (dattr.da_type == DAOS_PROP_CO_LAYOUT_POSIX) {
#ifdef LUSTRE_INCLUDE
if (dattr.da_on_lustre)
Expand Down Expand Up @@ -1369,6 +1361,14 @@ duns_destroy_path(daos_handle_t poh, const char *path)
}
}

/** Destroy the container */
rc = daos_cont_destroy(poh, dattr.da_cont, 1, NULL);
if (rc) {
D_ERROR("Failed to destroy container (%d)\n", rc);
/** recreate the link ? */
return daos_der2errno(rc);
}

return 0;
}

Expand Down
10 changes: 9 additions & 1 deletion src/container/oid_iv.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct oid_iv_entry {
struct oid_iv_range rg;
/** protect the entry */
ABT_mutex lock;
void *current_req;
};

/** Priv data in the iv layer */
Expand Down Expand Up @@ -130,7 +131,14 @@ oid_iv_ent_update(struct ds_iv_entry *ns_entry, struct ds_iv_key *iv_key,
D_ASSERT(priv != NULL);

entry = ns_entry->iv_value.sg_iovs[0].iov_buf;
ABT_mutex_lock(entry->lock);
rc = ABT_mutex_trylock(entry->lock);
/* For retry requests, from _iv_op(), the lock may not be released
* in some cases.
*/
if (rc == ABT_ERR_MUTEX_LOCKED && entry->current_req != src)
return -DER_BUSY;

entry->current_req = src;
avail = &entry->rg;

oids = src->sg_iovs[0].iov_buf;
Expand Down
1 change: 0 additions & 1 deletion src/control/cmd/daos/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ type fsCheckCmd struct {

FsckFlags FsCheckFlag `long:"flags" short:"f" description:"comma-separated flags: print, remove, relink, verify, evict"`
DirName string `long:"dir-name" short:"n" description:"directory name under lost+found to store leaked oids (a timestamp dir would be created if this is not specified)"`
Evict bool `long:"evict" short:"e" description:"evict all open handles on the container"`
}

func (cmd *fsCheckCmd) Execute(_ []string) error {
Expand Down
4 changes: 2 additions & 2 deletions src/control/lib/control/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ func processNVMeSpaceStats(log debugLogger, filterRank filterRankFn, nvmeControl
for _, smdDevice := range controller.SmdDevices {
if !smdDevice.Roles.IsEmpty() && (smdDevice.Roles.OptionBits&storage.BdevRoleData) == 0 {
log.Debugf("Skipping SMD device %s (rank %d, ctrlr %s) not used for storing data",
smdDevice.UUID, smdDevice.Rank, controller.PciAddr, smdDevice.Rank)
smdDevice.UUID, smdDevice.Rank, controller.PciAddr)
continue
}

Expand All @@ -1377,7 +1377,7 @@ func processNVMeSpaceStats(log debugLogger, filterRank filterRankFn, nvmeControl

if !filterRank(smdDevice.Rank) {
log.Debugf("Skipping SMD device %s (rank %d, ctrlr %s) not in ranklist",
smdDevice.UUID, smdDevice.Rank, controller.PciAddr, smdDevice.Rank)
smdDevice.UUID, smdDevice.Rank, controller.PciAddr)
continue
}

Expand Down
6 changes: 3 additions & 3 deletions src/engine/server_iv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2017-2023 Intel Corporation.
* (C) Copyright 2017-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -1053,7 +1053,7 @@ _iv_op(struct ds_iv_ns *ns, struct ds_iv_key *key, d_sg_list_t *value,
retry:
rc = iv_op_internal(ns, key, value, sync, shortcut, opc);
if (retry && !ns->iv_stop &&
(daos_rpc_retryable_rc(rc) || rc == -DER_NOTLEADER)) {
(daos_rpc_retryable_rc(rc) || rc == -DER_NOTLEADER || rc == -DER_BUSY)) {
if (rc == -DER_NOTLEADER && key->rank != (d_rank_t)(-1) &&
sync && (sync->ivs_mode == CRT_IV_SYNC_LAZY ||
sync->ivs_mode == CRT_IV_SYNC_EAGER)) {
Expand All @@ -1070,7 +1070,7 @@ _iv_op(struct ds_iv_ns *ns, struct ds_iv_key *key, d_sg_list_t *value,
* but in-flight fetch request return IVCB_FORWARD, then queued RPC will
* reply IVCB_FORWARD.
*/
D_WARN("ns %u retry for class %d opc %d rank %u/%u: " DF_RC "\n", ns->iv_ns_id,
D_INFO("ns %u retry for class %d opc %d rank %u/%u: " DF_RC "\n", ns->iv_ns_id,
key->class_id, opc, key->rank, ns->iv_master_rank, DP_RC(rc));
/* sleep 1sec and retry */
dss_sleep(1000);
Expand Down
Loading

0 comments on commit 9e2efb6

Please sign in to comment.