btrfs_match_dir_item_name() will check if its filetype is valid before doing search, this makes btrfs-progs unable to locate and remove invalid dir_index for btrfs_unlink().
This function only affects btrfs_link() and btrfs_unlink() in upper layer, and normal check can find invalid filetype by itself. So remove the filetype check is completely safe in this case, and will enhance btrfs_unlink() to remove invalid dir_index/dir_item for repair. Signed-off-by: Qu Wenruo <w...@suse.com> --- dir-item.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dir-item.c b/dir-item.c index 462546c0eaf4..e0a0ab4d7a5d 100644 --- a/dir-item.c +++ b/dir-item.c @@ -294,12 +294,6 @@ static int verify_dir_item(struct btrfs_root *root, u16 namelen = BTRFS_NAME_LEN; u8 type = btrfs_dir_type(leaf, dir_item); - if (type >= BTRFS_FT_MAX) { - fprintf(stderr, "invalid dir item type: %d\n", - (int)type); - return 1; - } - if (type == BTRFS_FT_XATTR) namelen = XATTR_NAME_MAX; -- 2.15.1 -- 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