Skip to contentSkip to conversation

Btrfs: fix dir item validation when replaying xattr deletes

PATCH In review [email protected] 2 participants 2 messages Jul 19, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: fix dir item validation when replaying xattr deletes

From: Filipe Manana <[email protected]>

We were passing an incorrect slot number to the function that validates directory items when we are replaying xattr deletes from a log tree. The correct slot is stored at variable 'i' and not at 'path->slots[0]', so the call to the validation function was only correct for the first iteration of the loop, when 'i == path->slots[0]'.
After this fix, the fstest generic/066 passes again.

Fixes 8ee8c2d62d5f ("btrfs: Verify dir_item in replay_xattr_deletes")
---
 fs/btrfs/tree-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/tree-log.c +1 -2
index f20ef211a73d..3a11ae63676e 100644
@@ -2153,8 +2153,7 @@ static int replay_xattr_deletes(struct btrfs_trans_handle *trans,
 			u32 this_len = sizeof(*di) + name_len + data_len;
 			char *name;
 
-			ret = verify_dir_item(fs_info, path->nodes[0],
-					      path->slots[0], di);
+			ret = verify_dir_item(fs_info, path->nodes[0], i, di);
 			if (ret) {
 				ret = -EIO;
 				goto out;
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Tue, Jul 18, 2017 at 08:34:02PM +0100, [email protected] wrote:

From: Filipe Manana <[email protected]>

We were passing an incorrect slot number to the function that validates directory items when we are replaying xattr deletes from a log tree. The correct slot is stored at variable 'i' and not at 'path->slots[0]', so the call to the validation function was only correct for the first iteration of the loop, when 'i == path->slots[0]'.
After this fix, the fstest generic/066 passes again.

Thanks. Fixing this was last on my list of known issue caused by some of the new 4.13 patches.