From: Mark Fasheh <mfas...@suse.com>

btrfs_get_parent() searches the btree for a ref to the current object. From
there it can compute the parent objectid from which it can return a dentry.
if the reference is not found in the tree however, we BUG(). I believe a
more appropriate response would be to go read-only as this seems like a
corruption.

Signed-off-by: Mark Fasheh <mfas...@suse.com>
---
 fs/btrfs/export.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 1b8dc33..a335169 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -193,7 +193,13 @@ static struct dentry *btrfs_get_parent(struct dentry 
*child)
        if (ret < 0)
                goto fail;
 
-       BUG_ON(ret == 0);
+       if (ret == 0) {
+               /* Missing ref, should go readonly. */
+               ret = -ENOENT;
+               btrfs_std_error(root->fs_info, ret);
+               goto fail;
+       }
+
        if (path->slots[0] == 0) {
                ret = -ENOENT;
                goto fail;
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to