summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Weinstein <yweinste@redhat.com>2025-01-17 17:08:51 +0100
committerGitHub <noreply@github.com>2025-01-17 17:08:51 +0100
commitd8e459a55e210c51c44cc7a4671f03e3ed2a941e (patch)
treeaba4f37c7ddea7431a1cb6835bbbb3df5d6d4d2d
parentMerge pull request #61384 from sj14/sj/delete-policy-204 (diff)
parentpybind/rados: add note for reversed arguments to WriteOp.zero() (diff)
downloadceph-d8e459a55e210c51c44cc7a4671f03e3ed2a941e.tar.xz
ceph-d8e459a55e210c51c44cc7a4671f03e3ed2a941e.zip
Merge pull request #59143 from Sean10/fix_rados_pybind_zero_param
pybind/rados: fix the incorrect order of offset,length in WriteOp.zero Reviewed-by: Radoslaw Zarzynski <rzarzyns@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
-rw-r--r--PendingReleaseNotes4
-rw-r--r--src/pybind/rados/rados.pyx2
-rw-r--r--src/test/pybind/test_rados.py5
3 files changed, 10 insertions, 1 deletions
diff --git a/PendingReleaseNotes b/PendingReleaseNotes
index b4824a65584..d25acfa9c6d 100644
--- a/PendingReleaseNotes
+++ b/PendingReleaseNotes
@@ -60,6 +60,10 @@
fuse client for `fallocate` for the default case (i.e. mode == 0) since
CephFS does not support disk space reservation. The only flags supported are
`FALLOC_FL_KEEP_SIZE` and `FALLOC_FL_PUNCH_HOLE`.
+* pybind/rados: Fixes WriteOp.zero() in the original reversed order of arguments
+ `offset` and `length`. When pybind calls WriteOp.zero(), the argument passed
+ does not match rados_write_op_zero, and offset and length are swapped, which
+ results in an unexpected response.
* The HeadBucket API now reports the `X-RGW-Bytes-Used` and `X-RGW-Object-Count`
headers only when the `read-stats` querystring is explicitly included in the
diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx
index b54ebb483c6..bcfa6777f3d 100644
--- a/src/pybind/rados/rados.pyx
+++ b/src/pybind/rados/rados.pyx
@@ -1870,7 +1870,7 @@ cdef class WriteOp(object):
uint64_t _offset = offset
with nogil:
- rados_write_op_zero(self.write_op, _length, _offset)
+ rados_write_op_zero(self.write_op, _offset, _length)
def truncate(self, offset: int):
"""
diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py
index 25423bd8dcb..881b29c9152 100644
--- a/src/test/pybind/test_rados.py
+++ b/src/test/pybind/test_rados.py
@@ -516,6 +516,11 @@ class TestIoctx(object):
eq(self.ioctx.read('write_ops'), b'12\x00\x005')
write_op.write_full(b'12345')
+ write_op.zero(0, 2)
+ self.ioctx.operate_write_op(write_op, "write_ops")
+ eq(self.ioctx.read('write_ops'), b'\x00\x00345')
+
+ write_op.write_full(b'12345')
write_op.truncate(2)
self.ioctx.operate_write_op(write_op, "write_ops")
eq(self.ioctx.read('write_ops'), b'12')