diff mbox series

btrfs: set ret to 0 in btrfs_get_extent

Message ID 20200903143715.14848-1-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: set ret to 0 in btrfs_get_extent | expand

Commit Message

Nikolay Borisov Sept. 3, 2020, 2:37 p.m. UTC
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"
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba Sept. 3, 2020, 3:10 p.m. UTC | #1
On Thu, Sep 03, 2020 at 05:38:29PM +0300, Nikolay Borisov wrote:
> 
> 
> On 3.09.20 г. 17:37 ч., Nikolay Borisov wrote:
> > 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"
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > ---
> 
> I believe this could simply be folded in the original patch, no ?

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

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3b63b858546e..a1081ec8e130 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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];