Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-17087 cart: fix crt_bulk_create() not accepting CRT_BULK_WO #15865

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cart/crt_bulk.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* (C) Copyright 2016-2022 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -89,9 +90,8 @@ crt_bulk_create(crt_context_t crt_ctx, d_sg_list_t *sgl,
int rc = 0;

if (crt_ctx == CRT_CONTEXT_NULL || !crt_sgl_valid(sgl) ||
/* Now HG treats WO as invalid parameter */
(bulk_perm != CRT_BULK_RW && bulk_perm != CRT_BULK_RO /* &&
bulk_perm != CRT_BULK_WO */) || bulk_hdl == NULL) {
(bulk_perm != CRT_BULK_RW && bulk_perm != CRT_BULK_RO && bulk_perm != CRT_BULK_WO) ||
bulk_hdl == NULL) {
D_ERROR("invalid parameter, crt_ctx: %p, "
"crt_sgl_valid: %d, bulk_perm: %d, bulk_hdl: %p.\n",
crt_ctx, crt_sgl_valid(sgl), bulk_perm, bulk_hdl);
Expand Down
19 changes: 17 additions & 2 deletions src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,9 +1610,24 @@ crt_hg_bulk_create(struct crt_hg_context *hg_ctx, d_sg_list_t *sgl,

D_ASSERT(hg_ctx != NULL && hg_ctx->chc_bulkcla != NULL);
D_ASSERT(sgl != NULL && bulk_hdl != NULL);
D_ASSERT(bulk_perm == CRT_BULK_RW || bulk_perm == CRT_BULK_RO);

flags = (bulk_perm == CRT_BULK_RW) ? HG_BULK_READWRITE : HG_BULK_READ_ONLY;
switch (bulk_perm) {
case CRT_BULK_RW:
flags = HG_BULK_READWRITE;
break;
case CRT_BULK_WO:
flags = HG_BULK_WRITE_ONLY;
break;
case CRT_BULK_RO:
flags = HG_BULK_READ_ONLY;
break;
default:
D_ASSERT(bulk_perm == CRT_BULK_RW || bulk_perm == CRT_BULK_RO ||
bulk_perm == CRT_BULK_WO);
rc = -DER_INVAL;
DL_ERROR(rc, "Invalid permissions");
return rc;
}

if (sgl->sg_nr <= CRT_HG_IOVN_STACK) {
buf_sizes = buf_sizes_stack;
Expand Down