Skip to contentSkip to conversation

btrfs: set ret to 0 in btrfs_get_extent

PATCH In review Nikolay Borisov 2 participants 3 messages Sep 3, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: set ret to 0 in btrfs_get_extent

When btrfs_get_extent is called for a range that has an overlapping inline extent coupled with with 'page' parameter being NULL it will erroneously return an error instead of the populate extent_mapping struct. Fix this by setting ret to 0 in case we don't have an exact match for our range.

Fixes 85b1eebdaf1d: "btrfs: remove err variable from btrfs_get_extent"
---
 fs/btrfs/inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
index 3b63b858546e..a1081ec8e130 100644
@@ -6593,6 +6593,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 		if (path->slots[0] == 0)
 			goto not_found;
 		path->slots[0]--;
+		ret = 0;
 	}
 
 	leaf = path->nodes[0];
Signature · 1 line
2.17.1
#1 lore raw
Quoted 9 lines · Nikolay Borisov

When btrfs_get_extent is called for a range that has an overlapping inline extent coupled with with 'page' parameter being NULL it will erroneously return an error instead of the populate extent_mapping struct. Fix this by setting ret to 0 in case we don't have an exact match for our range.

Fixes 85b1eebdaf1d: "btrfs: remove err variable from btrfs_get_extent"

---

I believe this could simply be folded in the original patch, no ?

Quoted 16 lines
 fs/btrfs/inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
index 3b63b858546e..a1081ec8e130 100644
@@ -6593,6 +6593,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 		if (path->slots[0] == 0)
 			goto not_found;
 		path->slots[0]--;
+		ret = 0;
 	}
 
 	leaf = path->nodes[0];
#2 lore raw
Quoted 9 lines · Nikolay Borisov
Quoted 6 lines · Nikolay Borisov

When btrfs_get_extent is called for a range that has an overlapping inline extent coupled with with 'page' parameter being NULL it will erroneously return an error instead of the populate extent_mapping struct. Fix this by setting ret to 0 in case we don't have an exact match for our range.

Quoted 5 lines
Quoted 3 lines
Fixes 85b1eebdaf1d: "btrfs: remove err variable from btrfs_get_extent"

---

I believe this could simply be folded in the original patch, no ?

Yes, that's what I'm going to do, thanks.