linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: set ret to 0 in btrfs_get_extent
@ 2020-09-03 14:37 Nikolay Borisov
  2020-09-03 14:38 ` Nikolay Borisov
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2020-09-03 14:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: 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"
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 1 +
 1 file changed, 1 insertion(+)

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];
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: set ret to 0 in btrfs_get_extent
  2020-09-03 14:37 [PATCH] btrfs: set ret to 0 in btrfs_get_extent Nikolay Borisov
@ 2020-09-03 14:38 ` Nikolay Borisov
  2020-09-03 15:10   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2020-09-03 14:38 UTC (permalink / raw)
  To: linux-btrfs, David Sterba



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 ?

>  fs/btrfs/inode.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> 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];
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: set ret to 0 in btrfs_get_extent
  2020-09-03 14:38 ` Nikolay Borisov
@ 2020-09-03 15:10   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-09-03 15:10 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs, David Sterba

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-03 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 14:37 [PATCH] btrfs: set ret to 0 in btrfs_get_extent Nikolay Borisov
2020-09-03 14:38 ` Nikolay Borisov
2020-09-03 15:10   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).