In set_metadata(), the calculation for new_allocated was incorrectly
applying the base-2 rounding mask to the old size variable instead of
the requested new_size. This commit fixes the logic to use the correct
target size when determining the new boundaries.
Fixes: https://tracker.ceph.com/issues/77009
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
auto op = librados::ObjectWriteOperation();
if (new_size > allocated) {
uint64_t mask = (1<<object_size)-1;
- new_allocated = min_growth + ((size + mask) & ~mask); /* round up base 2 */
+ new_allocated = min_growth + ((new_size + mask) & ~mask); /* round up base 2 */
op.setxattr(XATTR_ALLOCATED, uint2bl(new_allocated));
do_op = true;
if (logger) logger->inc(P_UPDATE_ALLOCATED);