]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: In BlueFS::truncate accept wierd alloc_unit
authorAdam Kupczyk <akupczyk@ibm.com>
Tue, 11 Mar 2025 10:52:15 +0000 (10:52 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 7 May 2025 11:27:17 +0000 (11:27 +0000)
The alignment of extents might not reflect current alloc_unit[bdev].
It might be caused be either fallback to alternate AU size for SLOW,
or change of allocation unit in DB or WAL.
In such cases, truncation just leaves extent untouched.

Fixes: https://tracker.ceph.com/issues/71235
Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/os/bluestore/BlueFS.cc

index 195dced51f3681283d7b4361da3edf7db03ed44a..a8f961074a50784f02405cc7a3857d02cc049db6 100644 (file)
@@ -4224,10 +4224,12 @@ int BlueFS::truncate(FileWriter *h, uint64_t offset)/*_WF_L*/
         changed_extents = true;
         ++p;
       } else {
-        // cut_off > p->length means that we misaligned the extent
-        ceph_assert(cut_off == p->length);
+        // Usually cut_off == p->length.
+        // Case cut_off > p->length means that we misaligned the extent
+        // or alloc size changed in the meantime.
+        // In both cases just leave extent untouched.
         fnode.allocated = (offset - x_off) + p->length;
-        ++p; // leave extent untouched
+        ++p;
       }
       while (p != fnode.extents.end()) {
         dirty.pending_release[p->bdev].insert(p->offset, p->length);