Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
btrfsprogs.356
0038-btrfs-progs-fsck-clear-out-log-tree-in-rep...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0038-btrfs-progs-fsck-clear-out-log-tree-in-repair-mode.patch of Package btrfsprogs.356
From adfe8b5cfb24971f7fe17bbcabd0d1a54d4599a6 Mon Sep 17 00:00:00 2001 From: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Date: Thu, 24 Apr 2014 11:19:16 +0800 Subject: [PATCH 038/303] btrfs-progs: fsck: clear out log tree in repair mode Repair mode will commit transaction which will make us fail to load log tree anymore. Give a warning to common users, if they really want to coninue, we will clear out log tree. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> --- cmds-check.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index afdd044d4754..59ef6071f812 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -6551,6 +6551,22 @@ out: return ret; } +static int zero_log_tree(struct btrfs_root *root) +{ + struct btrfs_trans_handle *trans; + int ret; + + trans = btrfs_start_transaction(root, 1); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + return ret; + } + btrfs_set_super_log_root(root->fs_info->super_copy, 0); + btrfs_set_super_log_root_level(root->fs_info->super_copy, 0); + ret = btrfs_commit_transaction(trans, root); + return ret; +} + static struct option long_options[] = { { "super", 1, NULL, 's' }, { "repair", 0, NULL, 0 }, @@ -6670,6 +6686,23 @@ int cmd_check(int argc, char **argv) } root = info->fs_root; + /* + * repair mode will force us to commit transaction which + * will make us fail to load log tree when mounting. + */ + if (repair && btrfs_super_log_root(info->super_copy)) { + ret = ask_user("repair mode will force to clear out log tree, Are you sure?"); + if (!ret) { + ret = 1; + goto close_out; + } + ret = zero_log_tree(root); + if (ret) { + fprintf(stderr, "fail to zero log tree\n"); + goto close_out; + } + } + uuid_unparse(info->super_copy->fsid, uuidbuf); if (qgroup_report) { printf("Print quota groups for %s\nUUID: %s\n", argv[optind], -- 2.1.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor