All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org,
	Gabriel Krisman Bertazi <krisman@collabora.com>
Subject: [PATCH e2fsprogs 09/11] e2fsck: Add option to force encoded filename verification
Date: Wed, 25 Mar 2020 17:18:09 -0400	[thread overview]
Message-ID: <20200325211812.2971787-10-krisman@collabora.com> (raw)
In-Reply-To: <20200325211812.2971787-1-krisman@collabora.com>

This is interesting for !strict filesystems as part of the encoding
update procedure. Once the filesystem is known to not have badly encoded
filenames, the update is trivial, thanks to the stability of assigned
code points in the unicode specification.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 e2fsck/e2fsck.h | 1 +
 e2fsck/pass2.c  | 5 +++--
 e2fsck/unix.c   | 4 ++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 335a5e4c6dca..f0d206a4cba0 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -177,6 +177,7 @@ struct resource_track {
 #define E2F_OPT_ICOUNT_FULLMAP	0x20000 /* use an array for inode counts */
 #define E2F_OPT_UNSHARE_BLOCKS  0x40000
 #define E2F_OPT_CLEAR_UNINIT	0x80000 /* Hack to clear the uninit bit */
+#define E2F_OPT_CHECK_ENCODING  0x100000 /* Force verification of encoded filenames */
 
 /*
  * E2fsck flags
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 3b9a2ac78b00..17e35d08c2b2 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -1048,9 +1048,10 @@ static int check_dir_block(ext2_filsys fs,
 	ctx = cd->ctx;
 
 	/* We only want filename encoding verification on strict
-	 * mode. */
+	 * mode or if explicitly requested by user. */
 	if (ext2fs_test_inode_bitmap2(ctx->inode_casefold_map, ino) &&
-	    (ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL))
+	    ((ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL) ||
+	     (ctx->options & E2F_OPT_CHECK_ENCODING)))
 		cf_dir = 1;
 
 	if (ctx->flags & E2F_FLAG_RUN_RETURN)
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index b3ef0f22b866..168b4784d65e 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -753,6 +753,9 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
 			ctx->options |= E2F_OPT_UNSHARE_BLOCKS;
 			ctx->options |= E2F_OPT_FORCE;
 			continue;
+		} else if (strcmp(token, "check_encoding") == 0) {
+			ctx->options |= E2F_OPT_CHECK_ENCODING;
+			continue;
 #ifdef CONFIG_DEVELOPER_FEATURES
 		} else if (strcmp(token, "clear_all_uninit_bits") == 0) {
 			ctx->options |= E2F_OPT_CLEAR_UNINIT;
@@ -784,6 +787,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
 		fputs("\tbmap2extent\n", stderr);
 		fputs("\tunshare_blocks\n", stderr);
 		fputs("\tfixes_only\n", stderr);
+		fputs("\tcheck_encoding\n", stderr);
 		fputc('\n', stderr);
 		exit(1);
 	}
-- 
2.25.0


  parent reply	other threads:[~2020-03-25 21:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 21:18 [PATCH e2fsprogs 00/11] Improvements for Case-insensitive handling Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 01/11] tune2fs: Allow enabling casefold feature after fs creation Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 02/11] tune2fs: Fix casefold+encrypt error message Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 03/11] ext2fs: Add method to validate casefolded strings Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 04/11] ext2fs: Implement faster CI comparison of strings Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 05/11] e2fsck: Fix entries with invalid encoded characters Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 06/11] e2fsck: Support casefold directories when rehashing Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 07/11] dict: Support comparison with context Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 08/11] e2fsck: Detect duplicated casefolded direntries for rehash Gabriel Krisman Bertazi
2020-03-25 21:18 ` Gabriel Krisman Bertazi [this message]
2020-03-25 21:18 ` [PATCH e2fsprogs 10/11] e2fsck.8.in: Document check_encoding extended option Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 11/11] tests: f_bad_fname: Test fixes of invalid filenames and duplicates Gabriel Krisman Bertazi
2020-03-25 21:18 ` [PATCH e2fsprogs 11/11] tests: f_bad_fname: Validate fix " Gabriel Krisman Bertazi
2020-03-26 17:25   ` Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200325211812.2971787-10-krisman@collabora.com \
    --to=krisman@collabora.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.