diff mbox

btrfs: verify_dir_item fails in replay_xattr_deletes

Message ID 20170802053521.22053-1-lufq.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lu Fengqi Aug. 2, 2017, 5:35 a.m. UTC
From: Su Yue <suy.fnst@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.fnst@cn.fujitsu.com>
---
 fs/btrfs/tree-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Nikolay Borisov Aug. 2, 2017, 6:10 a.m. UTC | #1
On  2.08.2017 08:35, Lu Fengqi wrote:
> From: Su Yue <suy.fnst@cn.fujitsu.com>
> 
> In replay_xattr_deletes(), the argument @slot of verify_dir_item()
> should be variable @i instead of path->slots[0].


This was already fix in a patch sent by Filipe. Title is:

[PATCH] Btrfs: fix dir item validation when replaying xattr deletes

> 
> 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.fnst@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;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;