From: Chris Mason <chris.mason@oracle.com>
To: liubo <liubo2009@cn.fujitsu.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: forced readonly mounts on errors
Date: Mon, 17 Jan 2011 14:56:53 -0500 [thread overview]
Message-ID: <1295293927-sup-5879@think> (raw)
In-Reply-To: <4D25A7D1.7050602@cn.fujitsu.com>
Excerpts from liubo's message of 2011-01-06 06:30:25 -0500:
>
> This patch comes from "Forced readonly mounts on errors" ideas.
>
> As we know, this is the first step in being more fault tolerant of disk
> corruptions instead of just using BUG() statements.
>
> The major content:
> - add a framework for generating errors that should result in filesystems
> going readonly.
> - keep FS state in disk super block.
> - make sure that all of resource will be freed and released at umount time.
> - make sure that after FS is forced readonly on error, there will be no more
> disk change before FS is corrected. For this, we should stop write operation.
>
> After this patch is applied, the conversion from BUG() to such a framework can
> happen incrementally.
I think this is a good overall framework and it will meet our needs
nicely as we scale up the error handling in the filesystem.
One concern I have is where we save the error state to disk:
> +static void __save_error_info(struct btrfs_fs_info *fs_info)
> +{
> + struct btrfs_super_block *disk_super = &fs_info->super_copy;
> +
> + fs_info->fs_state = BTRFS_SUPER_FLAG_ERROR;
> + disk_super->flags |= cpu_to_le64(BTRFS_SUPER_FLAG_ERROR);
> +
> + mutex_lock(&fs_info->trans_mutex);
> + memcpy(&fs_info->super_for_commit, disk_super,
> + sizeof(fs_info->super_for_commit));
> + mutex_unlock(&fs_info->trans_mutex);
The super_for_commit isn't changed until we have a fully consistent set
of fields in the super block. The super_copy is changed as the
transaction progresses.
So, this memcpy isn't quite safe. We should simply set the flag on the
super_for_commit and the super_copy individually.
I'll make this change and pull it in. We can build from here.
-chris
next prev parent reply other threads:[~2011-01-17 19:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4D24160C.6070900@cn.fujitsu.com>
[not found] ` <4D252E42.5060803@cn.fujitsu.com>
[not found] ` <4D258BC7.8040105@cn.fujitsu.com>
2011-01-06 11:30 ` [PATCH] Btrfs: forced readonly mounts on errors liubo
2011-01-17 19:56 ` Chris Mason [this message]
2011-01-18 2:06 ` liubo
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=1295293927-sup-5879@think \
--to=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=liubo2009@cn.fujitsu.com \
/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).