Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1030763ybb; Wed, 25 Mar 2020 14:18:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vurGfpRAvym48pM6yQbefU45DJf+U1bhYM/ZrH4JiyI3Kxw9I0jMmx33e6nSm5OwdeAKTUB X-Received: by 2002:a9d:544:: with SMTP id 62mr4026559otw.355.1585171124615; Wed, 25 Mar 2020 14:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585171124; cv=none; d=google.com; s=arc-20160816; b=cL4lGKD00fETMgWk3Jy53Yl0vf39fx7yPmEJR0O3Sf/wX4Zk3VqgKqplRuVHvUAGe2 gyS2UbctiI/ysHd8k6rsuxSN56xV0zSzmnVeqxmqklv9x7d7MARTvgydjs08+FT4OP8T M5pVpzw75XpZurAx3DhbWmexn0ZWmM/WqZsLS6MAnsspp9o/cYhrTSRkdjTqHLyTNJn2 oZykynecvmsBpmXpYFTMVQT2J13yVj8dh2S+/fMKygRI7Ttvj92QdZeQucbZ3oOzib2a azMjWSR1cjjlPUPcSA1zOJ0rXO0Ten0voe/lBvWFXnB2E4M+HpOOigflg1Qhipgx/7TQ v5yg== 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=UlpiHG2y0a0kiTGw+OoIo85qZbQy8itCC0MK8vmZMtM=; b=MFMCLHTiw6el5YSxOW0CUOZuMJQiZ7qd385/akbZ+N3TDAIPP5DnsXoMJY6d41I5h7 J/HcPsv7L6GGKK3gQqq87A23F1FV8q6VbLCeSgSVyKPpudp5g1Pf/1uQMtQAvqUIUgKz ELZANmli+C8eTbI6dGm7QrcsmzYWlmoCWZBoMhVVdwN0m7T1If5SDdxxYwdDLWMiYptK 5lyI1CcgQYEtPbc0ElifAq/XMgxrif1nL98nZDxXPPExzISMTcQE+wIxadkRPqpBL0nl sKch3yPVyn+xsTvOdcABZcIK9cGfgv6Sr5FO2MysVOgA+gX/ekocSnKGOpuDMFnAhb9X 4TvA== 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 r21si148906oth.185.2020.03.25.14.18.26; Wed, 25 Mar 2020 14:18:44 -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 S1727357AbgCYVSY (ORCPT + 99 others); Wed, 25 Mar 2020 17:18:24 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39544 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbgCYVSY (ORCPT ); Wed, 25 Mar 2020 17:18:24 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 21D5C28666B From: Gabriel Krisman Bertazi To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH e2fsprogs 01/11] tune2fs: Allow enabling casefold feature after fs creation Date: Wed, 25 Mar 2020 17:18:01 -0400 Message-Id: <20200325211812.2971787-2-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 The main reason we didn't allow this before was because !CASEFOLDED directories were expected to be normalized(). Since this is no longer the case, and as long as the encrypt feature is not enabled, it should be safe to enable this feature. Disabling the feature is trickier, since we need to make sure there are no existing +F directories in the filesystem. Leave that for a future patch. Also, enabling strict mode requires some filesystem-wide verification, so ignore that for now. Signed-off-by: Gabriel Krisman Bertazi --- misc/tune2fs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index a0448f63d1d5..656389c61281 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -161,7 +161,8 @@ static __u32 ok_features[3] = { EXT4_FEATURE_INCOMPAT_64BIT | EXT4_FEATURE_INCOMPAT_ENCRYPT | EXT4_FEATURE_INCOMPAT_CSUM_SEED | - EXT4_FEATURE_INCOMPAT_LARGEDIR, + EXT4_FEATURE_INCOMPAT_LARGEDIR | + EXT4_FEATURE_INCOMPAT_CASEFOLD, /* R/O compat */ EXT2_FEATURE_RO_COMPAT_LARGE_FILE | EXT4_FEATURE_RO_COMPAT_HUGE_FILE| @@ -1462,6 +1463,19 @@ mmp_error: } } + if (FEATURE_ON(E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_CASEFOLD)) { + if (ext2fs_has_feature_encrypt(sb)) { + fputs(_("Cannot enable casefold feature on filesystems " + "with the encrypt feature enabled.\n"), + stderr); + return 1; + } + + sb->s_encoding = EXT4_ENC_UTF8_12_1; + sb->s_encoding_flags = e2p_get_encoding_flags(sb->s_encoding); + } + + if (sb->s_rev_level == EXT2_GOOD_OLD_REV && (sb->s_feature_compat || sb->s_feature_ro_compat || sb->s_feature_incompat)) -- 2.25.0