Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into tanabarr/control-sy…
Browse files Browse the repository at this point in the history
…srsvd-bump

Allow-unstable: true
Test-tag: pr daily_regression
Test-nvme: auto_md_on_ssd

Signed-off-by: Tom Nabarro <tom.nabarro@intel.com>
  • Loading branch information
tanabarr committed Jul 26, 2023
2 parents 3f3692d + dbfbfde commit a8a280c
Show file tree
Hide file tree
Showing 82 changed files with 1,551 additions and 820 deletions.
6 changes: 6 additions & 0 deletions docs/admin/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,12 @@ per four target threads, for example `targets: 16` and `nr_xs_helpers: 4`.
The server should have sufficiently many physical cores to support the
number of targets plus the additional service threads.

The 'targets:' and 'nr_xs_helpers:' requirement are mandatory, if the number
of physical cores are not enough it will fail the starting of the daos engine
(notes that 2 cores reserved for system service), or configures with ENV
"DAOS_TARGET_OVERSUBSCRIBE=1" to force starting daos engine (possibly hurts
performance as multiple XS compete on same core).


## Storage Formatting

Expand Down
2 changes: 1 addition & 1 deletion src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dump_envariables(void)
int i;
char *val;
char *envars[] = {"D_PROVIDER", "D_INTERFACE", "D_DOMAIN", "D_PORT",
"CRT_PHY_ADDR_STR", "D_LOG_STDERR_IN_LOG",
"CRT_PHY_ADDR_STR", "D_LOG_STDERR_IN_LOG", "D_LOG_SIZE",
"D_LOG_FILE", "D_LOG_FILE_APPEND_PID", "D_LOG_MASK", "DD_MASK",
"DD_STDERR", "DD_SUBSYS", "CRT_TIMEOUT", "CRT_ATTACH_INFO_PATH",
"OFI_PORT", "OFI_INTERFACE", "OFI_DOMAIN", "CRT_CREDIT_EP_CTX",
Expand Down
3 changes: 3 additions & 0 deletions src/client/api/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ daos_array_close(daos_handle_t oh, daos_event_t *ev)
tse_task_t *task;
int rc;

if (ev == NULL)
return dc_array_close_direct(oh);

rc = dc_task_create(dc_array_close, NULL, ev, &task);
if (rc)
return rc;
Expand Down
5 changes: 4 additions & 1 deletion src/client/api/kv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2021 Intel Corporation.
* (C) Copyright 2016-2023 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -43,6 +43,9 @@ daos_kv_close(daos_handle_t oh, daos_event_t *ev)
tse_task_t *task;
int rc;

if (ev == NULL)
return dc_kv_close_direct(oh);

rc = dc_task_create(dc_kv_close, NULL, ev, &task);
if (rc)
return rc;
Expand Down
3 changes: 3 additions & 0 deletions src/client/api/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ daos_obj_close(daos_handle_t oh, daos_event_t *ev)
tse_task_t *task;
int rc;

if (ev == NULL)
return dc_obj_close_direct(oh);

rc = dc_obj_close_task_create(oh, ev, NULL, &task);
if (rc)
return rc;
Expand Down
26 changes: 25 additions & 1 deletion src/client/array/dc_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ open_handle_cb(tse_task_t *task, void *data)

if (rc != 0) {
D_ERROR("Failed to open object "DF_RC"\n", DP_RC(rc));
D_GOTO(err_obj, rc);
return rc;
}

/** check and set array metadata in case of array_open */
Expand Down Expand Up @@ -828,6 +828,30 @@ dc_array_open(tse_task_t *task)
return rc;
}

int
dc_array_close_direct(daos_handle_t oh)
{
struct dc_array *array;
int rc;

array = array_hdl2ptr(oh);
if (array == NULL)
return -DER_NO_HDL;

rc = daos_obj_close(array->daos_oh, NULL);
if (rc) {
D_ERROR("daos_obj_close() failed: "DF_RC"\n", DP_RC(rc));
array_decref(array);
return rc;
}

/* -1 for ref taken here */
array_decref(array);
/* -1 for array handle */
array_decref(array);
return 0;
}

int
dc_array_close(tse_task_t *task)
{
Expand Down
11 changes: 5 additions & 6 deletions src/client/dfs/dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,17 +1250,16 @@ open_file(dfs_t *dfs, dfs_obj_t *parent, int flags, daos_oclass_id_t cid,

/** just try fetching entry to open the file */
rc2 = daos_array_close(file->oh, NULL);
if (rc2 == -DER_NOMEM)
rc2 = daos_array_close(file->oh, NULL);
if (rc2)
if (rc2) {
D_ERROR("daos_array_close() failed "DF_RC"\n", DP_RC(rc2));
return daos_der2errno(rc2);
}
} else if (rc) {
int rc2;

rc2 = daos_array_close(file->oh, NULL);
if (rc2 == -DER_NOMEM)
daos_array_close(file->oh, NULL);

if (rc2)
D_ERROR("daos_array_close() failed "DF_RC"\n", DP_RC(rc2));
D_DEBUG(DB_TRACE, "Insert file entry %s failed (%d)\n", file->name, rc);
return rc;
} else {
Expand Down
16 changes: 2 additions & 14 deletions src/client/dfs/dfs_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,10 @@ static void
hash_rec_free(struct d_hash_table *htable, d_list_t *rlink)
{
struct hash_hdl *hdl = hash_hdl_obj(rlink);
int rc = 0;

D_DEBUG(DB_TRACE, "name=%s\n", hdl->name);

rc = dfs_release(hdl->obj);
if (rc == ENOMEM)
dfs_release(hdl->obj);
dfs_release(hdl->obj);
D_FREE(hdl->name);
D_FREE(hdl);
}
Expand Down Expand Up @@ -795,7 +792,6 @@ dfs_sys_stat(dfs_sys_t *dfs_sys, const char *path, int flags,
struct stat *buf)
{
int rc;
int rc2;
struct sys_path sys_path;
dfs_obj_t *obj;
int lookup_flags = O_RDWR;
Expand Down Expand Up @@ -825,10 +821,7 @@ dfs_sys_stat(dfs_sys_t *dfs_sys, const char *path, int flags,
sys_path.name, rc);
D_GOTO(out_free_path, rc);
}

rc2 = dfs_release(obj);
if (rc2 == ENOMEM)
dfs_release(obj);
dfs_release(obj);

out_free_path:
sys_path_free(dfs_sys, &sys_path);
Expand Down Expand Up @@ -1219,8 +1212,6 @@ dfs_sys_close(dfs_obj_t *obj)
int rc = 0;

rc = dfs_release(obj);
if (rc == ENOMEM)
dfs_release(obj);
return rc;
}

Expand Down Expand Up @@ -1475,9 +1466,6 @@ dfs_sys_closedir(DIR *dirp)
sys_dir = (struct dfs_sys_dir *)dirp;

rc = dfs_release(sys_dir->obj);
if (rc == ENOMEM)
dfs_release(sys_dir->obj);

D_FREE(sys_dir);

return rc;
Expand Down
21 changes: 21 additions & 0 deletions src/client/dfuse/dfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ struct dfuse_info {
*/
pthread_spinlock_t di_lock;

/* RW lock used for force filesystem query ioctl to block for pending forget calls. */
pthread_rwlock_t di_forget_lock;

/** Hash table of open inodes, this matches kernel ref counts */
struct d_hash_table dpi_iet;
/** Hash table of open pools */
Expand Down Expand Up @@ -791,6 +794,24 @@ struct dfuse_inode_entry {
bool ie_unlinked;
};

static inline struct dfuse_inode_entry *
dfuse_inode_lookup(struct dfuse_info *dfuse_info, fuse_ino_t ino)
{
d_list_t *rlink;

rlink = d_hash_rec_find(&dfuse_info->dpi_iet, &ino, sizeof(ino));
if (!rlink)
return NULL;

return container_of(rlink, struct dfuse_inode_entry, ie_htl);
}

static inline void
dfuse_inode_decref(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie)
{
d_hash_rec_decref(&dfuse_info->dpi_iet, &ie->ie_htl);
}

extern char *duns_xattr_name;

/* Generate the inode to use for this dfs object. This is generating a single
Expand Down
9 changes: 5 additions & 4 deletions src/client/dfuse/dfuse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,8 @@ dfuse_fs_init(struct dfuse_info *fs_handle)

D_SPIN_INIT(&fs_handle->di_lock, 0);

D_RWLOCK_INIT(&fs_handle->di_forget_lock, 0);

for (i = 0; i < fs_handle->di_eq_count; i++) {
struct dfuse_eq *eqt = &fs_handle->di_eqt[i];

Expand Down Expand Up @@ -1071,6 +1073,7 @@ dfuse_fs_init(struct dfuse_info *fs_handle)

err_eq:
D_SPIN_DESTROY(&fs_handle->di_lock);
D_RWLOCK_DESTROY(&fs_handle->di_forget_lock);

for (i = 0; i < fs_handle->di_eq_count; i++) {
struct dfuse_eq *eqt = &fs_handle->di_eqt[i];
Expand Down Expand Up @@ -1136,11 +1139,8 @@ dfuse_ie_close(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie)

if (ie->ie_obj) {
rc = dfs_release(ie->ie_obj);
if (rc == ENOMEM)
rc = dfs_release(ie->ie_obj);
if (rc) {
if (rc)
DFUSE_TRA_ERROR(ie, "dfs_release() failed: %d (%s)", rc, strerror(rc));
}
}

if (ie->ie_root) {
Expand Down Expand Up @@ -1529,6 +1529,7 @@ dfuse_fs_fini(struct dfuse_info *dfuse_info)
int i;

D_SPIN_DESTROY(&dfuse_info->di_lock);
D_RWLOCK_DESTROY(&dfuse_info->di_forget_lock);

for (i = 0; i < dfuse_info->di_eq_count; i++) {
struct dfuse_eq *eqt = &dfuse_info->di_eqt[i];
Expand Down
6 changes: 1 addition & 5 deletions src/client/dfuse/il/int_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,9 @@ ioil_shrink_cont(struct ioil_cont *cont, bool shrink_pool, bool force)
static void
entry_array_close(void *arg) {
struct fd_entry *entry = arg;
int rc;

DFUSE_TRA_DOWN(entry->fd_dfsoh);
rc = dfs_release(entry->fd_dfsoh);
if (rc == ENOMEM)
dfs_release(entry->fd_dfsoh);

dfs_release(entry->fd_dfsoh);
entry->fd_cont->ioc_open_count -= 1;

/* Do not close container/pool handles at this point
Expand Down
53 changes: 23 additions & 30 deletions src/client/dfuse/ops/forget.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2022 Intel Corporation.
* (C) Copyright 2016-2023 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -8,58 +8,51 @@
#include "dfuse.h"

static void
dfuse_forget_one(struct dfuse_projection_info *fs_handle,
fuse_ino_t ino, uintptr_t nlookup)
dfuse_forget_one(struct dfuse_info *dfuse_info, fuse_ino_t ino, uintptr_t nlookup)
{
d_list_t *rlink;
int rc;
struct dfuse_inode_entry *ie;
int rc;

/* One additional reference is needed because the rec_find() itself
* acquires one
*/
/* One additional reference is needed because the rec_find() itself acquires one */
nlookup++;

rlink = d_hash_rec_find(&fs_handle->dpi_iet, &ino, sizeof(ino));
if (!rlink) {
DFUSE_TRA_WARNING(fs_handle, "Unable to find ref for %#lx %lu",
ino, nlookup);
ie = dfuse_inode_lookup(dfuse_info, ino);
if (!ie) {
DFUSE_TRA_WARNING(dfuse_info, "Unable to find ref for %#lx %lu", ino, nlookup);
return;
}

DFUSE_TRA_DEBUG(container_of(rlink, struct dfuse_inode_entry, ie_htl),
"inode %#lx count %lu",
ino, nlookup);
DFUSE_TRA_DEBUG(ie, "inode %#lx count %lu", ino, nlookup);

rc = d_hash_rec_ndecref(&fs_handle->dpi_iet, nlookup, rlink);
if (rc != -DER_SUCCESS) {
DFUSE_TRA_ERROR(fs_handle, "Invalid refcount %lu on %p",
nlookup,
container_of(rlink, struct dfuse_inode_entry,
ie_htl));
}
rc = d_hash_rec_ndecref(&dfuse_info->dpi_iet, nlookup, &ie->ie_htl);
if (rc != -DER_SUCCESS)
DFUSE_TRA_ERROR(dfuse_info, "Invalid refcount %lu on %p", nlookup, ie);
}

void
dfuse_cb_forget(fuse_req_t req, fuse_ino_t ino, uintptr_t nlookup)
{
struct dfuse_projection_info *fs_handle = fuse_req_userdata(req);
struct dfuse_info *dfuse_info = fuse_req_userdata(req);

fuse_reply_none(req);

dfuse_forget_one(fs_handle, ino, nlookup);
dfuse_forget_one(dfuse_info, ino, nlookup);
}

void
dfuse_cb_forget_multi(fuse_req_t req, size_t count,
struct fuse_forget_data *forgets)
dfuse_cb_forget_multi(fuse_req_t req, size_t count, struct fuse_forget_data *forgets)
{
struct dfuse_projection_info *fs_handle = fuse_req_userdata(req);
int i;
struct dfuse_info *dfuse_info = fuse_req_userdata(req);
int i;

fuse_reply_none(req);

DFUSE_TRA_DEBUG(fs_handle, "Forgetting %zi", count);
DFUSE_TRA_DEBUG(dfuse_info, "Forgetting %zi", count);

D_RWLOCK_RDLOCK(&dfuse_info->di_forget_lock);

for (i = 0; i < count; i++)
dfuse_forget_one(fs_handle, forgets[i].ino, forgets[i].nlookup);
dfuse_forget_one(dfuse_info, forgets[i].ino, forgets[i].nlookup);

D_RWLOCK_UNLOCK(&dfuse_info->di_forget_lock);
}
15 changes: 8 additions & 7 deletions src/client/dfuse/ops/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,16 @@ handle_cont_qe_ioctl_helper(fuse_req_t req, const struct dfuse_mem_query *in_que
struct dfuse_mem_query query = {};

if (in_query && in_query->ino) {
d_list_t *rlink;
struct dfuse_inode_entry *ie;

rlink =
d_hash_rec_find(&dfuse_info->dpi_iet, &in_query->ino, sizeof(in_query->ino));
if (rlink) {
D_RWLOCK_WRLOCK(&dfuse_info->di_forget_lock);

ie = dfuse_inode_lookup(dfuse_info, in_query->ino);
if (ie) {
query.found = true;
d_hash_rec_decref(&dfuse_info->dpi_iet, rlink);
dfuse_inode_decref(dfuse_info, ie);
}
D_RWLOCK_UNLOCK(&dfuse_info->di_forget_lock);
}

query.inode_count = atomic_load_relaxed(&dfuse_info->di_inode_count);
Expand All @@ -326,11 +328,10 @@ static void
handle_cont_query_ioctl(fuse_req_t req, const void *in_buf, size_t in_bufsz)
{
struct dfuse_info *dfuse_info = fuse_req_userdata(req);
struct dfuse_mem_query query = {};
const struct dfuse_mem_query *in_query = in_buf;
int rc;

if (in_bufsz != sizeof(query))
if (in_bufsz != sizeof(struct dfuse_mem_query))
D_GOTO(err, rc = EIO);

handle_cont_qe_ioctl_helper(req, in_query);
Expand Down
Loading

0 comments on commit a8a280c

Please sign in to comment.