From: Su Yue <suy.f...@cn.fujitsu.com>

In replay_xattr_deletes(), the argument @slot of verify_dir_item()
should be variable @i instead of path->slots[0].

The bug causes failure of generic/066 and shared/002 in xfstest.
dmesg:
[12507.810781] BTRFS critical (device dm-0): invalid dir item name len: 10
[12507.811185] BTRFS: error (device dm-0) in btrfs_replay_log:2475: errno=-5 IO 
failure (Failed to recover log tree)
[12507.811928] BTRFS error (device dm-0): cleaner transaction attach returned 
-30
[12507.821020] BTRFS error (device dm-0): open_ctree failed
[12508.131526] BTRFS info (device dm-0): disk space caching is enabled
[12508.132145] BTRFS info (device dm-0): has skinny extents
[12508.136265] BTRFS critical (device dm-0): invalid dir item name len: 10
[12508.136678] BTRFS: error (device dm-0) in btrfs_replay_log:2475: errno=-5 IO 
failure (Failed to recover log tree)
[12508.137501] BTRFS error (device dm-0): cleaner transaction attach returned 
-30
[12508.147982] BTRFS error (device dm-0): open_ctree failed

Signed-off-by: Su Yue <suy.f...@cn.fujitsu.com>
---
 fs/btrfs/tree-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f20ef211a73d..3a11ae63676e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -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;
-- 
2.13.3



--
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

Reply via email to