Skip to content

Commit

Permalink
DAOS-15276 object: log refine
Browse files Browse the repository at this point in the history
Required-githooks: true

Signed-off-by: Xuezhao Liu <xuezhao.liu@intel.com>
  • Loading branch information
liuxuezhao committed May 9, 2024
1 parent 25cca27 commit fa264fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/client/dfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ dfs_setxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, const void *value, da
return EINVAL;
if (name == NULL)
return EINVAL;
if (value == NULL && size != 0)
return EINVAL;
if (strnlen(name, DFS_MAX_XATTR_NAME + 1) > DFS_MAX_XATTR_NAME)
return EINVAL;
if (size > DFS_MAX_XATTR_LEN)
Expand All @@ -64,7 +62,10 @@ dfs_setxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, const void *value, da
iods[0].iod_recxs = NULL;
iods[0].iod_type = DAOS_IOD_SINGLE;
iods[0].iod_size = size;
d_iov_set(&sg_iovs[0], (void *)value, size);
if (value == NULL)
d_iov_set(&sg_iovs[0], NULL, 0);
else
d_iov_set(&sg_iovs[0], (void *)value, size);
sgls[0].sg_nr = 1;
sgls[0].sg_nr_out = 0;
sgls[0].sg_iovs = &sg_iovs[0];
Expand Down Expand Up @@ -145,8 +146,6 @@ dfs_getxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value, daos_siz
return EINVAL;
if (name == NULL)
return EINVAL;
if (value == NULL && size != NULL && *size > 0)
return EINVAL;
if (strnlen(name, DFS_MAX_XATTR_NAME + 1) > DFS_MAX_XATTR_NAME)
return EINVAL;

Expand All @@ -172,7 +171,10 @@ dfs_getxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value, daos_siz
iod.iod_size = *size;

/** set sgl for fetch */
d_iov_set(&sg_iov, value, *size);
if (value == NULL)
d_iov_set(&sg_iov, NULL, 0);
else
d_iov_set(&sg_iov, value, *size);
sgl.sg_nr = 1;
sgl.sg_nr_out = 0;
sgl.sg_iovs = &sg_iov;
Expand Down
6 changes: 5 additions & 1 deletion src/object/cli_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,11 @@ obj_iod_sgl_valid(daos_obj_id_t oid, unsigned int nr, daos_iod_t *iods,
for (j = 0; j < sg->sg_nr; j++) {
iov = sg->sg_iovs + j;
if (iov == NULL || (iov->iov_buf_len > 0 && iov->iov_buf == NULL)) {
D_ERROR("Bad iov\n");
if (iov == NULL)
D_ERROR("Bad iov - j %d, NULL iov\n", j);
else
D_ERROR("Bad iov - j %d, NULL iov_buf, "
"bul_len %zu\n", j, iov->iov_buf_len);
return -DER_INVAL;
}
}
Expand Down

0 comments on commit fa264fb

Please sign in to comment.