diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2018-04-02 20:59:48 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-10-21 10:45:14 +0300 |
commit | a344af28753129bfbfdba05a1c00104829901fa4 (patch) | |
tree | d5a69cf60f0d6f6c7960155476a05fbb6cbf7bea /fs/btrfs | |
parent | 3a2b7ef459098a10c13cb1351a7b73e9a7736957 (diff) | |
download | linux-a344af28753129bfbfdba05a1c00104829901fa4.tar.xz |
Btrfs: bail out on error during replay_dir_deletes
commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 upstream.
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 <nborisov@suse.com>
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/tree-log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index cf909b18032f..63d9e0a784a1 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1979,8 +1979,10 @@ again: 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]); |