From bf1609036a235c7de99b8a258e119cc5a7b9c2f3 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 11 May 2018 13:34:34 -0700 Subject: [PATCH] AOSP: e2fsck: imply -f when using -E unshare_blocks Signed-off-by: Theodore Ts'o Google-Bug-Id: 64109868 Test: e2fsck -E unshare_blocks does a full scan Change-Id: Idc36ceba3bf24e1fb1487feedefe9a68f9acc7f3 From AOSP commit: 7c180d6598363722de6195d142d7677bbc2b0161 --- e2fsck/e2fsck.8.in | 2 +- e2fsck/unix.c | 1 + tests/f_unshare_blocks_no_space/script | 2 +- tests/f_unshare_blocks_ok/script | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in index da9f618..4e3890b 100644 --- a/e2fsck/e2fsck.8.in +++ b/e2fsck/e2fsck.8.in @@ -276,7 +276,7 @@ blocks anyway, then this option will have no effect. Note when using this option, if there is no free space to clone blocks, there is no prompt to delete files and instead the operation will fail. .IP -Note that unshare_blocks requires the "-f" option to ensure that all passes +Note that unshare_blocks implies the "-f" option to ensure that all passes are run. Additionally, if "-n" is also specified, e2fsck will simulate trying to allocate enough space to deduplicate. If this fails, the exit code will be non-zero. diff --git a/e2fsck/unix.c b/e2fsck/unix.c index e604f42..581fd62 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -742,6 +742,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts) continue; } else if (strcmp(token, "unshare_blocks") == 0) { ctx->options |= E2F_OPT_UNSHARE_BLOCKS; + ctx->options |= E2F_OPT_FORCE; continue; } else { fprintf(stderr, _("Unknown extended option: %s\n"), diff --git a/tests/f_unshare_blocks_no_space/script b/tests/f_unshare_blocks_no_space/script index bc44354..89d2aef 100644 --- a/tests/f_unshare_blocks_no_space/script +++ b/tests/f_unshare_blocks_no_space/script @@ -1,2 +1,2 @@ -FSCK_OPT="-yf -E unshare_blocks" +FSCK_OPT="-y -E unshare_blocks" . $cmd_dir/run_e2fsck diff --git a/tests/f_unshare_blocks_ok/script b/tests/f_unshare_blocks_ok/script index bc44354..89d2aef 100644 --- a/tests/f_unshare_blocks_ok/script +++ b/tests/f_unshare_blocks_ok/script @@ -1,2 +1,2 @@ -FSCK_OPT="-yf -E unshare_blocks" +FSCK_OPT="-y -E unshare_blocks" . $cmd_dir/run_e2fsck -- 1.8.3.1