Skip to contentSkip to conversation

btrfs: tree-checker: Add DATA_RELOC tree to essential non-empty tree list

PATCH In review Qu Wenruo 3 participants 3 messages Jul 19, 2018 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs: tree-checker: Add DATA_RELOC tree to essential non-empty tree list

DATA RELOC tree should also never be empty.

---
It's possible just fold this fix into commit "btrfs: tree-checker: Detect invalid empty essential tree".

And for the test image, it can already be rejected by misc-next branch by the enhanced dev-extent checker.

---
 fs/btrfs/tree-checker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/tree-checker.c +2 -1
index 4c82a628df85..db835635372f 100644
@@ -504,7 +504,8 @@ static int check_leaf(struct btrfs_fs_info *fs_info, struct extent_buffer *leaf,
 		    owner == BTRFS_CHUNK_TREE_OBJECTID ||
 		    owner == BTRFS_EXTENT_TREE_OBJECTID ||
 		    owner == BTRFS_DEV_TREE_OBJECTID ||
-		    owner == BTRFS_FS_TREE_OBJECTID) {
+		    owner == BTRFS_FS_TREE_OBJECTID ||
+		    owner == BTRFS_DATA_RELOC_TREE_OBJECTID) {
 			generic_err(fs_info, leaf, 0,
 			"invalid root, root %llu must never be empty",
 				    owner);
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Qu Wenruo

DATA RELOC tree should also never be empty.

Quoted 25 lines

---
It's possible just fold this fix into commit "btrfs: tree-checker: Detect invalid empty essential tree".

And for the test image, it can already be rejected by misc-next branch by the enhanced dev-extent checker.

---
  fs/btrfs/tree-checker.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/tree-checker.c +2 -1
index 4c82a628df85..db835635372f 100644
@@ -504,7 +504,8 @@ static int check_leaf(struct btrfs_fs_info *fs_info, struct extent_buffer *leaf,
  		    owner == BTRFS_CHUNK_TREE_OBJECTID ||
  		    owner == BTRFS_EXTENT_TREE_OBJECTID ||
  		    owner == BTRFS_DEV_TREE_OBJECTID ||
-		    owner == BTRFS_FS_TREE_OBJECTID) {
+		    owner == BTRFS_FS_TREE_OBJECTID ||
+		    owner == BTRFS_DATA_RELOC_TREE_OBJECTID) {
  			generic_err(fs_info, leaf, 0,
  			"invalid root, root %llu must never be empty",
  				    owner);