lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 211/320] btrfs: remove BUG_ON() in find_parent_nodes()
    Date
    From: Josef Bacik <josef@toxicpanda.com>

    [ Upstream commit fcba0120edf88328524a4878d1d6f4ad39f2ec81 ]

    We search for an extent entry with .offset = -1, which shouldn't be a
    thing, but corruption happens. Add an ASSERT() for the developers,
    return -EUCLEAN for mortals.

    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/btrfs/backref.c | 7 ++++++-
    1 file changed, 6 insertions(+), 1 deletion(-)

    diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
    index 7f644a58db511..9044e7282d0b2 100644
    --- a/fs/btrfs/backref.c
    +++ b/fs/btrfs/backref.c
    @@ -1208,7 +1208,12 @@ again:
    ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0);
    if (ret < 0)
    goto out;
    - BUG_ON(ret == 0);
    + if (ret == 0) {
    + /* This shouldn't happen, indicates a bug or fs corruption. */
    + ASSERT(ret != 0);
    + ret = -EUCLEAN;
    + goto out;
    + }

    #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
    if (trans && likely(trans->type != __TRANS_DUMMY) &&
    --
    2.34.1


    \
     
     \ /
      Last update: 2022-01-24 21:44    [W:2.295 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site