path: root/cmds-check.c
diff options
authorJosef Bacik <>2014-10-10 16:57:14 -0400
committerDavid Sterba <>2014-10-14 10:45:25 +0200
commitbb561f5485ab5852214e115116507524e45daff8 (patch)
treec94c180753dd12a9baf665ac835e9178bc4cf8c9 /cmds-check.c
parentb25a40651d15c8ca795ab7a4f1b8150128f09e3c (diff)
Btrfs-progs: add a dummy backref if our location is wrong
If our location is bogus in our dir item we were just skipping the thing. However in this case we want to just delete the dir index, so create a dummy inode rec using BTRFS_MULTIPLE_OBJECTIDS and just add every backref we find to the list so we know to straight up delete all of these items. Thanks, Signed-off-by: Josef Bacik <> Signed-off-by: David Sterba <>
Diffstat (limited to 'cmds-check.c')
1 files changed, 7 insertions, 1 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 2219e758..8150203f 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -563,6 +563,8 @@ static struct inode_backref *get_inode_backref(struct inode_record *rec,
struct inode_backref *backref;
list_for_each_entry(backref, &rec->backrefs, list) {
+ break;
if (backref->dir != dir || backref->namelen != namelen)
if (memcmp(name, backref->name, namelen))
@@ -1004,7 +1006,11 @@ static int process_dir_item(struct btrfs_root *root,
namebuf, len, filetype,
key->type, error);
} else {
- fprintf(stderr, "warning line %d\n", __LINE__);
+ fprintf(stderr, "invalid location in dir item %u\n",
+ location.type);
+ add_inode_backref(inode_cache, BTRFS_MULTIPLE_OBJECTIDS,
+ key->objectid, key->offset, namebuf,
+ len, filetype, key->type, error);
len = sizeof(*di) + name_len + data_len;