From: lijian <[email protected]>
When lookup_extent_mapping failed, should return '-ENOENT'.
Signed-off-by: lijian <[email protected]>
---
fs/btrfs/extent_map.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 4a8e02f7b6c7..e9d9f2bfc11d 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -305,8 +305,10 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
WARN_ON(!em || em->start != start);
- if (!em)
+ if (!em) {
+ ret = -ENOENT;
goto out;
+ }
em->generation = gen;
clear_bit(EXTENT_FLAG_PINNED, &em->flags);
--
2.17.1
On 29/06/2021 12:41, [email protected] wrote:
> From: lijian <[email protected]>
>
> When lookup_extent_mapping failed, should return '-ENOENT'.
>
> Signed-off-by: lijian <[email protected]>
> ---
> fs/btrfs/extent_map.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> index 4a8e02f7b6c7..e9d9f2bfc11d 100644
> --- a/fs/btrfs/extent_map.c
> +++ b/fs/btrfs/extent_map.c
> @@ -305,8 +305,10 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
>
> WARN_ON(!em || em->start != start);
>
> - if (!em)
> + if (!em) {
> + ret = -ENOENT;
> goto out;
> + }
>
> em->generation = gen;
> clear_bit(EXTENT_FLAG_PINNED, &em->flags);
>
You'll still need to properly handle the returned error in the caller,
otherwise this patch makes no sense at all.
Also the subject should be something like "btrfs: handle failures from unpin_extent_cache" or
sth. like this.