diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 01e1a0897195..c6320c43319a 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1359,10 +1359,18 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret = -EUCLEAN; + goto out; + } while (eie->next) eie = eie->next; eie->next = ref->inode_list;