btrfs-progs: check: verify name in dir_item for original mode
authorSu Yue <suy.fnst@cn.fujitsu.com>
Fri, 14 Jul 2017 07:47:44 +0000 (15:47 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 24 Aug 2017 17:07:46 +0000 (19:07 +0200)
commitd4833d709b338df0edf7a721a155e9e00723911a
tree891cd5555c2ac797c0a1114115b0d3839834168b
parent0cd4485178dcf97f2ed58a59f5d3ade56aa11eb3
btrfs-progs: check: verify name in dir_item for original mode

In original mode, we don't check if the name in dir_item matches the
hash in key.offset.

In the following case, original mode will report nothing wrong while
lowmem mode will detect the name and hash mismatch.

------
item 72 key (79177 DIR_ITEM 54846528) itemoff 12380 itemsize 88
        location key (4222342 INODE_ITEM 0) type FILE
        transid 170929 data_len 0 name_len 14
        name: deprecated.sxt
        location key (13590433 INODE_ITEM 0) type FILE
        transid 796448 data_len 0 name_len 14
        name: deprecated.txt
------
In above case, hash of "deprecated.txt" matches with 54846528,
while hash of "deprecated.sxt" should be 2008317993.

Reported-by: Filippe LeMarchand <gasinvein@gmail.com>
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c