[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240914064158.75664-1-lizhi.xu@windriver.com>
Date: Sat, 14 Sep 2024 14:41:58 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+56360f93efa90ff15870@...kaller.appspotmail.com>
CC: <clm@...com>, <dsterba@...e.com>, <josef@...icpanda.com>,
<linux-btrfs@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<syzkaller-bugs@...glegroups.com>
Subject: Re: [syzbot] [btrfs?] general protection fault in write_all_supers
if we have IGNOREDATACSUMS then don't need to backup csum root
#syz test
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a6f5441e62d1..415ad3b07032 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1679,7 +1679,6 @@ static void backup_super_roots(struct btrfs_fs_info *info)
if (!btrfs_fs_compat_ro(info, BLOCK_GROUP_TREE)) {
struct btrfs_root *extent_root = btrfs_extent_root(info, 0);
- struct btrfs_root *csum_root = btrfs_csum_root(info, 0);
btrfs_set_backup_extent_root(root_backup,
extent_root->node->start);
@@ -1688,11 +1687,15 @@ static void backup_super_roots(struct btrfs_fs_info *info)
btrfs_set_backup_extent_root_level(root_backup,
btrfs_header_level(extent_root->node));
- btrfs_set_backup_csum_root(root_backup, csum_root->node->start);
- btrfs_set_backup_csum_root_gen(root_backup,
- btrfs_header_generation(csum_root->node));
- btrfs_set_backup_csum_root_level(root_backup,
- btrfs_header_level(csum_root->node));
+ if (!btrfs_test_opt(info, IGNOREDATACSUMS)) {
+ struct btrfs_root *csum_root = btrfs_csum_root(info, 0);
+
+ btrfs_set_backup_csum_root(root_backup, csum_root->node->start);
+ btrfs_set_backup_csum_root_gen(root_backup,
+ btrfs_header_generation(csum_root->node));
+ btrfs_set_backup_csum_root_level(root_backup,
+ btrfs_header_level(csum_root->node));
+ }
}
/*
Powered by blists - more mailing lists