linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: bail out on error during replay_dir_deletes
@ 2018-03-30 22:11 Liu Bo
  2018-04-01 10:10 ` Nikolay Borisov
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2018-03-30 22:11 UTC (permalink / raw)
  To: linux-btrfs

If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs
to bail out, otherwise @ret would be forced to be 0 after 'break;' and
the caller won't be aware of it.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 fs/btrfs/tree-log.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4ee9431..11e2c26 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2356,8 +2356,10 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
 			nritems = btrfs_header_nritems(path->nodes[0]);
 			if (path->slots[0] >= nritems) {
 				ret = btrfs_next_leaf(root, path);
-				if (ret)
+				if (ret == 1)
 					break;
+				else if (ret < 0)
+					goto out;
 			}
 			btrfs_item_key_to_cpu(path->nodes[0], &found_key,
 					      path->slots[0]);
-- 
1.8.3.1


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

* Re: [PATCH] Btrfs: bail out on error during replay_dir_deletes
  2018-03-30 22:11 [PATCH] Btrfs: bail out on error during replay_dir_deletes Liu Bo
@ 2018-04-01 10:10 ` Nikolay Borisov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Borisov @ 2018-04-01 10:10 UTC (permalink / raw)
  To: Liu Bo, linux-btrfs



On 31.03.2018 01:11, Liu Bo wrote:
> If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs
> to bail out, otherwise @ret would be forced to be 0 after 'break;' and
> the caller won't be aware of it.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

This is also a long-standing bug and needs stable@
> ---
>  fs/btrfs/tree-log.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 4ee9431..11e2c26 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -2356,8 +2356,10 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
>  			nritems = btrfs_header_nritems(path->nodes[0]);
>  			if (path->slots[0] >= nritems) {
>  				ret = btrfs_next_leaf(root, path);
> -				if (ret)
> +				if (ret == 1)
>  					break;
> +				else if (ret < 0)
> +					goto out;
>  			}
>  			btrfs_item_key_to_cpu(path->nodes[0], &found_key,
>  					      path->slots[0]);
> 

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

end of thread, other threads:[~2018-04-01 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30 22:11 [PATCH] Btrfs: bail out on error during replay_dir_deletes Liu Bo
2018-04-01 10:10 ` Nikolay Borisov

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).