diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 29a19bc2abe18..16169b35ab6e5 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1437,10 +1437,18 @@ again: 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;