linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH] btrfs: set ret to 0 in btrfs_get_extent
Date: Thu,  3 Sep 2020 17:37:15 +0300	[thread overview]
Message-ID: <20200903143715.14848-1-nborisov@suse.com> (raw)

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


             reply	other threads:[~2020-09-03 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 14:37 Nikolay Borisov [this message]
2020-09-03 14:38 ` [PATCH] btrfs: set ret to 0 in btrfs_get_extent Nikolay Borisov
2020-09-03 15:10   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903143715.14848-1-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).