* [PATCH] btrfs-progs: fsck: report each critical root corruption separately
@ 2014-06-03 16:37 David Sterba
2014-06-04 1:40 ` Wang Shilong
0 siblings, 1 reply; 2+ messages in thread
From: David Sterba @ 2014-06-03 16:37 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, Wang Shilong
Explicitly say which critical root is corrupted. It is possible to
repair or reset some of the roots with a special option.
CC: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
---
Patch based on the fsck branch from integration with other fsck fixes,
namely "Btrfs-progs: fsck: deal with corrupted csum root"
cmds-check.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/cmds-check.c b/cmds-check.c
index b62132f22e84..58e5322bfe96 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -6933,10 +6933,18 @@ int cmd_check(int argc, char **argv)
uuid_unparse(info->super_copy->fsid, uuidbuf);
printf("Checking filesystem on %s\nUUID: %s\n", argv[optind], uuidbuf);
- if (!extent_buffer_uptodate(info->tree_root->node) ||
- !extent_buffer_uptodate(info->dev_root->node) ||
- !extent_buffer_uptodate(info->chunk_root->node)) {
- fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
+ if (!extent_buffer_uptodate(info->tree_root->node)) {
+ fprintf(stderr, "Critical root (tree_root) corrupted, unable to continue\n");
+ ret = -EIO;
+ goto close_out;
+ }
+ if (!extent_buffer_uptodate(info->dev_root->node)) {
+ fprintf(stderr, "Critical root (dev_root) corrupted, unable to continue\n");
+ ret = -EIO;
+ goto close_out;
+ }
+ if(!extent_buffer_uptodate(info->chunk_root->node)) {
+ fprintf(stderr, "Critical root (chunk_root) corrupted, unable to continue\n");
ret = -EIO;
goto close_out;
}
@@ -6959,10 +6967,10 @@ int cmd_check(int argc, char **argv)
}
if (init_csum_tree) {
- fprintf(stderr, "Reinit crc root\n");
+ fprintf(stderr, "Reinitialize csum_root\n");
ret = btrfs_fsck_reinit_root(trans, info->csum_root, 0);
if (ret) {
- fprintf(stderr, "crc root initialization failed\n");
+ fprintf(stderr, "ERROR: csum_root initialization failed\n");
ret = -EIO;
goto close_out;
}
@@ -6976,12 +6984,12 @@ int cmd_check(int argc, char **argv)
goto close_out;
}
if (!extent_buffer_uptodate(info->extent_root->node)) {
- fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
+ fprintf(stderr, "Critical root (extent_root) corrupted, unable to continue\n");
ret = -EIO;
goto close_out;
}
if (!extent_buffer_uptodate(info->csum_root->node)) {
- fprintf(stderr, "Checksum root corrupted, rerun with --init-csum-tree option\n");
+ fprintf(stderr, "Checksum root (csum_root) corrupted, unable to continue\n");
ret = -EIO;
goto close_out;
}
--
1.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: fsck: report each critical root corruption separately
2014-06-03 16:37 [PATCH] btrfs-progs: fsck: report each critical root corruption separately David Sterba
@ 2014-06-04 1:40 ` Wang Shilong
0 siblings, 0 replies; 2+ messages in thread
From: Wang Shilong @ 2014-06-04 1:40 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs
On 06/04/2014 12:37 AM, David Sterba wrote:
> Explicitly say which critical root is corrupted. It is possible to
> repair or reset some of the roots with a special option.
David, thanks for doing this:-)
>
> CC: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> Signed-off-by: David Sterba <dsterba@suse.cz>
> ---
>
> Patch based on the fsck branch from integration with other fsck fixes,
> namely "Btrfs-progs: fsck: deal with corrupted csum root"
>
> cmds-check.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/cmds-check.c b/cmds-check.c
> index b62132f22e84..58e5322bfe96 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -6933,10 +6933,18 @@ int cmd_check(int argc, char **argv)
> uuid_unparse(info->super_copy->fsid, uuidbuf);
> printf("Checking filesystem on %s\nUUID: %s\n", argv[optind], uuidbuf);
>
> - if (!extent_buffer_uptodate(info->tree_root->node) ||
> - !extent_buffer_uptodate(info->dev_root->node) ||
> - !extent_buffer_uptodate(info->chunk_root->node)) {
> - fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
> + if (!extent_buffer_uptodate(info->tree_root->node)) {
> + fprintf(stderr, "Critical root (tree_root) corrupted, unable to continue\n");
> + ret = -EIO;
> + goto close_out;
> + }
> + if (!extent_buffer_uptodate(info->dev_root->node)) {
> + fprintf(stderr, "Critical root (dev_root) corrupted, unable to continue\n");
> + ret = -EIO;
> + goto close_out;
> + }
> + if(!extent_buffer_uptodate(info->chunk_root->node)) {
> + fprintf(stderr, "Critical root (chunk_root) corrupted, unable to continue\n");
> ret = -EIO;
> goto close_out;
> }
> @@ -6959,10 +6967,10 @@ int cmd_check(int argc, char **argv)
> }
>
> if (init_csum_tree) {
> - fprintf(stderr, "Reinit crc root\n");
> + fprintf(stderr, "Reinitialize csum_root\n");
> ret = btrfs_fsck_reinit_root(trans, info->csum_root, 0);
> if (ret) {
> - fprintf(stderr, "crc root initialization failed\n");
> + fprintf(stderr, "ERROR: csum_root initialization failed\n");
> ret = -EIO;
> goto close_out;
> }
> @@ -6976,12 +6984,12 @@ int cmd_check(int argc, char **argv)
> goto close_out;
> }
> if (!extent_buffer_uptodate(info->extent_root->node)) {
> - fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
> + fprintf(stderr, "Critical root (extent_root) corrupted, unable to continue\n");
> ret = -EIO;
> goto close_out;
> }
> if (!extent_buffer_uptodate(info->csum_root->node)) {
> - fprintf(stderr, "Checksum root corrupted, rerun with --init-csum-tree option\n");
> + fprintf(stderr, "Checksum root (csum_root) corrupted, unable to continue\n");
> ret = -EIO;
> goto close_out;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-04 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 16:37 [PATCH] btrfs-progs: fsck: report each critical root corruption separately David Sterba
2014-06-04 1:40 ` Wang Shilong
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).