Btrfs: bail out on error during replay_dir_deletes
PATCH v2 1/1 Btrfs: bail out on error during replay_dir_deletes
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.
Fixes e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
Reviewed-by Nikolay Borisov <[email protected]>
Signed-off-by Liu Bo <[email protected]>
---
v2: Add Fixes tag and reviewed-by.~
fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -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 ]);
Signature · 1 line
1.8.3.1
Quoted 7 lines · Liu Bo
If errors were returned by
btrfs_next_leaf(),replay_dir_deletesneeds to bail out, otherwise @ret would be forced to be 0 after 'break;' and the caller won't be aware of it.Fixes e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")Reviewed-by Nikolay Borisov <[email protected]>Signed-off-by Liu Bo <[email protected]>
Added to next, thanks.