Signed-off-by: Wang Shilong <wangsl.f...@cn.fujitsu.com>
---
 cmds-check.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index db7df80..0e4e042 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -6810,8 +6810,7 @@ int cmd_check(int argc, char **argv)
        int option_index = 0;
        int init_csum_tree = 0;
        int qgroup_report = 0;
-       enum btrfs_open_ctree_flags ctree_flags =
-               OPEN_CTREE_PARTIAL | OPEN_CTREE_EXCLUSIVE;
+       enum btrfs_open_ctree_flags ctree_flags = OPEN_CTREE_EXCLUSIVE;
 
        while(1) {
                int c;
@@ -6877,6 +6876,10 @@ int cmd_check(int argc, char **argv)
                goto err_out;
        }
 
+       /* only allow partial opening under repair mode */
+       if (repair)
+               ctree_flags |= OPEN_CTREE_PARTIAL;
+
        info = open_ctree_fs_info(argv[optind], bytenr, 0, ctree_flags);
        if (!info) {
                fprintf(stderr, "Couldn't open file system\n");
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to