]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
btrfs: replace BUG() with error handling in __btrfs_balance()
authorAdarsh Das <adarshdas950@gmail.com>
Tue, 3 Feb 2026 17:23:57 +0000 (22:53 +0530)
committerDavid Sterba <dsterba@suse.com>
Wed, 18 Feb 2026 14:25:53 +0000 (15:25 +0100)
We search with offset (u64)-1 which should never match exactly.
Previously this was handled with BUG(). Now logs an error
and return -EUCLEAN.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index f281d113519b97025d7077a5940a71564f431044..50f7aae70418f8509094ebe414773126e36a1fdf 100644 (file)
@@ -4367,8 +4367,14 @@ again:
                 * this shouldn't happen, it means the last relocate
                 * failed
                 */
-               if (ret == 0)
-                       BUG(); /* FIXME break ? */
+               if (unlikely(ret == 0)) {
+                       btrfs_err(fs_info,
+                                 "unexpected exact match of CHUNK_ITEM in chunk tree, offset 0x%llx",
+                                 key.offset);
+                       mutex_unlock(&fs_info->reclaim_bgs_lock);
+                       ret = -EUCLEAN;
+                       goto error;
+               }
 
                ret = btrfs_previous_item(chunk_root, path, 0,
                                          BTRFS_CHUNK_ITEM_KEY);