From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v4 0/3] btrfs: Add write time super block validation
Date: Fri, 25 May 2018 12:43:22 +0800 [thread overview]
Message-ID: <20180525044325.3365-1-wqu@suse.com> (raw)
This patchset can be fetched from github:
https://github.com/adam900710/linux/tree/write_time_sb_check
We have 2 reports about corrupted btrfs super block, which has some garbage
in its super block, but otherwise it's completely fine and its csum even
matches.
This means we develop memory corruption during btrfs mount time.
It's not clear whether it's caused by btrfs or some other kernel module,
but at least let's do write time verification to catch such corruption
early.
Current design is to do 2 different checks at mount time and super write
time.
And for write time check, it only checks the template super block
(fs_info->super_to_commit) other than each super blocks to be written to
disk, mostly to avoid duplicated checks.
Changelog:
v2:
Rename btrfs_check_super_valid() to btrfs_validate_super() suggested
by Nikolay and David.
v3:
Add a new patch to move btrfs_check_super_valid() to avoid forward
declaration.
Refactor btrfs_check_super_valid() to provide better naming and
function reusablity.
Code style and comment update.
Use 2 different functions, btrfs_validate_mount_super() and
btrfs_validate_write_super(), for mount and write time super check.
v4:
Change the timing of btrfs_validate_write_super() to handle seed
sprout case, where the original superblock can be from seed device,
which has a different fsid. Thanks Anand for exposing this bug.
Only the last patch is affected.
Qu Wenruo (3):
btrfs: Move btrfs_check_super_valid() to avoid forward declaration
btrfs: Refactor btrfs_check_super_valid()
btrfs: Do super block verification before writing it to disk
fs/btrfs/disk-io.c | 365 ++++++++++++++++++++++++++-------------------
1 file changed, 214 insertions(+), 151 deletions(-)
--
2.17.0
next reply other threads:[~2018-05-25 4:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 4:43 Qu Wenruo [this message]
2018-05-25 4:43 ` [PATCH v4 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration Qu Wenruo
2018-05-25 4:43 ` [PATCH v4 2/3] btrfs: Refactor btrfs_check_super_valid() Qu Wenruo
2018-05-25 5:15 ` Su Yue
2018-05-25 4:43 ` [PATCH v4 3/3] btrfs: Do super block verification before writing it to disk Qu Wenruo
2018-05-25 6:33 ` Nikolay Borisov
2018-05-25 7:46 ` Qu Wenruo
2018-05-25 15:31 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180525044325.3365-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).