Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1031129ybb; Wed, 25 Mar 2020 14:19:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv8VARNl9iTuuqk5wPwOkdJB8JT+wo9Da7lm07MkMpryYlkUTi514QAXicpTsI1NB7llE/X X-Received: by 2002:aca:482:: with SMTP id 124mr4006070oie.35.1585171149110; Wed, 25 Mar 2020 14:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585171149; cv=none; d=google.com; s=arc-20160816; b=TjVx2X6KXjsxY93e0KPaxs9Mg9LeHi5hiw3DsT3eXHHAPwkQdliOHzojnkGDp2QNJV 0qAb/vg+k4wB9fJKYkrsfanC5X8ORJ2GkDaD8ghMeU4Y2zfxjxVJeqLQSIC/7ZdHMuoy +1vSuA19xOvhxhGf5aO0dGOgHIV3cP6HegjJuQzen9mZEvgYubJ0dRunHCMFO5N3bgV7 q6Itve7OzIOv3W5LU6ZAAcdQZQCtUN/NHoO21GxPmrUzlHgqBi3Y7x1HHmmJ+xdMWXMv 4p4+Gf3fU08GGA76vghZsNxJPzPgfI4D9mJe+aEEFtigWp3/7QBBpjlutIq+fta3GknX 8c5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=btGIW0fwmYxcZQel6xdGcZH0zQgHJE8l5qLzfvdsYkg=; b=vzsOCOIULBJO7Gbk5KQ5/+5SUqQZveyCpmEXEioX+wFZklyef3yWqR9crHkHoKZlyw 4zlSC1MJ5dkQskcumJ+asdh48aHKfhkrWZhxkHzP+o5dI7I9UKQQDvmDOckmw8+P3fJU 8fVq/IpgAHNYt6rZraJj5jbsuEkQU3uCHtUyJ4CM1f8lmTepUGZy9MM+6BKSLih/8Tqq Cqx+9RfMyx6dUPEHmo5RK+WYyD2zMDWFeKMgAE8P7oJP98ADUG8tX2ZWgHtFgyanKnYS WOYE10fvNXV6ejT+KDcigvutoMIJ7JXnXe23nE6HNPxweW8biH6GRQWBZQXWXyv6Oi7S YNbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si138411otn.173.2020.03.25.14.18.57; Wed, 25 Mar 2020 14:19:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727399AbgCYVSx (ORCPT + 99 others); Wed, 25 Mar 2020 17:18:53 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39590 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbgCYVSx (ORCPT ); Wed, 25 Mar 2020 17:18:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 6898028666B From: Gabriel Krisman Bertazi To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH e2fsprogs 09/11] e2fsck: Add option to force encoded filename verification Date: Wed, 25 Mar 2020 17:18:09 -0400 Message-Id: <20200325211812.2971787-10-krisman@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200325211812.2971787-1-krisman@collabora.com> References: <20200325211812.2971787-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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