From: David Anderson Date: Fri, 11 May 2018 20:34:34 +0000 (-0700) Subject: AOSP: e2fsck: imply -f when using -E unshare_blocks X-Git-Tag: v1.44.3-rc1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf1609036a235c7de99b8a258e119cc5a7b9c2f3;p=thirdparty%2Fe2fsprogs.git 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 --- diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in index da9f61852..4e3890b2d 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 e604f4253..581fd62d7 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 bc44354ff..89d2aefb5 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 bc44354ff..89d2aefb5 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