Skip to content

Commit b62fd63

Browse files
fdmananakdave
authored andcommitted
btrfs: fix invalid extref key setup when replaying dentry
The offset for an extref item's key is not the object ID of the parent dir, otherwise we would not need the extref item and would use plain ref items. Instead the offset is the result of a hash computation that uses the object ID of the parent dir and the name associated to the entry. So fix this by setting the key offset at replay_one_name() to be the result of calling btrfs_extref_hash(). Fixes: 725af92 ("btrfs: Open-code name_in_log_ref in replay_one_name") Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 3d12674 commit b62fd63

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
19641964

19651965
search_key.objectid = log_key.objectid;
19661966
search_key.type = BTRFS_INODE_EXTREF_KEY;
1967-
search_key.offset = key->objectid;
1967+
search_key.offset = btrfs_extref_hash(key->objectid, name.name, name.len);
19681968
ret = backref_in_log(root->log_root, &search_key, key->objectid, &name);
19691969
if (ret < 0) {
19701970
goto out;

0 commit comments

Comments
 (0)