Skip to content

Commit

Permalink
DAOS-6709 rsvc: xfer only attr size and fix tests (#4745)
Browse files Browse the repository at this point in the history
This is a new way to fix extra data leak problem if
destination buffer is larger than real attr size.

To allow for only requested or attr exact size to be sent and
avoid packing by Mercury, each segment has to be sent as a
single bulk transfer instead as all being part of the same
bulk transfer and have Mercury do own management.

This allows to conform with original behaviour, so
no associated tests need to be modified anymore.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
  • Loading branch information
bfaccini authored Mar 23, 2021
1 parent 4a0d1c5 commit 644779e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/rsvc/srv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ ds_rsvc_get_attr(struct ds_rsvc *svc, struct rdb_tx *tx, rdb_path_t *path,
crt_bulk_t local_bulk;
daos_size_t bulk_size;
daos_size_t input_size;
daos_size_t local_offset, remote_offset;
d_iov_t *iovs;
d_sg_list_t sgl;
void *data;
Expand Down Expand Up @@ -259,7 +260,28 @@ ds_rsvc_get_attr(struct ds_rsvc *svc, struct rdb_tx *tx, rdb_path_t *path,
goto out_iovs;

rc = attr_bulk_transfer(rpc, CRT_BULK_PUT, local_bulk, remote_bulk,
0, key_length, bulk_size - key_length);
0, key_length, count * sizeof(*sizes));
if (rc != 0)
goto out_iovs;

local_offset = count * sizeof(*sizes);
remote_offset = key_length + count * sizeof(*sizes);

for (i = 1; i < sgl.sg_nr; i++) {
daos_size_t size;

size = min(sgl.sg_iovs[i].iov_len,
sgl.sg_iovs[i].iov_buf_len);
rc = attr_bulk_transfer(rpc, CRT_BULK_PUT, local_bulk,
remote_bulk, local_offset,
remote_offset, size);
if (rc != 0)
goto out_iovs;

local_offset += sgl.sg_iovs[i].iov_buf_len;
remote_offset += sgl.sg_iovs[i].iov_buf_len;
}

crt_bulk_free(local_bulk);
if (rc != 0)
goto out_iovs;
Expand Down

0 comments on commit 644779e

Please sign in to comment.