Skip to content

Commit 7e93afe

Browse files
authored
Merge pull request ceph#66377 from baum/rbd_aio_write_with_crc32c_initial_fix
librbd: rbd_aio_write_with_crc32c store CRC32C with initial value -1 to match msgr2 validation Reviewed-by: Ilya Dryomov <[email protected]>
2 parents 43ba152 + 36d99e3 commit 7e93afe

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/include/rbd/librbd.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,11 @@ CEPH_RBD_API int rbd_aio_write(rbd_image_t image, uint64_t off, size_t len,
12801280
CEPH_RBD_API int rbd_aio_write2(rbd_image_t image, uint64_t off, size_t len,
12811281
const char *buf, rbd_completion_t c,
12821282
int op_flags);
1283-
12841283
/*
1285-
* @param precomputed_crc32c: CRC32C checksum that was precomputed (e.g., by SPDK NVMf)
1284+
* @param precomputed_crc32c: CRC32C checksum that was precomputed with -1
1285+
* as the initial value (i.e. with the CRC "register" initialized to
1286+
* 0xFFFFFFFF)
1287+
* @param op_flags: see librados.h constants beginning with LIBRADOS_OP_FLAG
12861288
*/
12871289
CEPH_RBD_API int rbd_aio_write_with_crc32c(rbd_image_t image, uint64_t off,
12881290
size_t len, const char *buf,

src/librbd/librbd.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6418,8 +6418,9 @@ extern "C" int rbd_aio_write_with_crc32c(rbd_image_t image, uint64_t off,
64186418

64196419
auto aio_completion = get_aio_completion(comp);
64206420
auto raw = create_write_raw(ictx, buf, len, aio_completion);
6421+
// store with initial value -1
64216422
raw->set_crc(std::make_pair(0, len),
6422-
std::make_pair(0, precomputed_crc32c));
6423+
std::make_pair(-1, precomputed_crc32c));
64236424
bufferlist bl;
64246425
bl.push_back(std::move(raw));
64256426
librbd::api::Io<>::aio_write(

0 commit comments

Comments
 (0)