Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4863066pxu; Thu, 10 Dec 2020 07:16:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJw393Z1MdgecAF6/AT6AGZFft5+sfn+pFWjt4l1DU6CIysuddAHca2XuTHU+rC1Rf8ksBZZ X-Received: by 2002:a17:906:ceca:: with SMTP id si10mr6730283ejb.547.1607613397314; Thu, 10 Dec 2020 07:16:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607613397; cv=none; d=google.com; s=arc-20160816; b=R2a66YYa9wdwvxzbfKhu3n7T1x4vEj7CnqOG2AasBlZQsaduyWOSN7BgRt8vZSSNpz fDSlod/3ycYvSw3eITp3SU/S+922YM2pXRjF9qOfbTl7TQGcGVv+NKutjqbsK8mDonOm INiz/zmuzB5swi/GmSxGnBFLu+0WjzwezeC111ioAQvCUehAcOshCsTyvtDgj4rtSwuV i5jdBc/eIsCLwAVhc3cCFemtU6IyWN6CQE1entFJPs1cwygdFAt9By7a8CUOko8h6/nZ ku9g/FdcbSav9rQWkPgIhBYI+H/gCFh8bsQW2vnWfxwHPXaxAZwJSswBzTZ7iz5bjUVb ZLJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7H4MntKv1Gqqx4hATvndoevXGmNA8znCnHrsaZXdsDw=; b=OGCpWyCjbIOuzvnxNHx3+N5StV1Qa/KKBZ5sh20zLJSyCkD8GmuYLbxcHjBB0zP+2H B/H+UDU/QmCYJnWUhcZMfKj6SQP7HOB+41WUjnOJ4ielgekk+U734KPtx1vNQ6O1QnNO m8+k6PW52Xr3mi9/t++PnHt8fROdGaE+KbiMeTBjcrr2A6luC7AZpM/83qwZjxTIwE7V CRsYZDlpkdO9Z9GsBaE+ROOnmYB+epYfqpH+AZW7w4GqYL7sXW6SR/AaUGhD5I9cnQWM Ss9U7WAfC4svczNeqAQ2HjBV8tZmazWfXzhdAjzU1UeTVc1ibIYVApnNrVlZnyZhVERk 5SMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id b24si2849493eds.235.2020.12.10.07.16.10; Thu, 10 Dec 2020 07:16:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 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 S2388907AbgLJPFH (ORCPT + 99 others); Thu, 10 Dec 2020 10:05:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388867AbgLJPEs (ORCPT ); Thu, 10 Dec 2020 10:04:48 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871E3C061793 for ; Thu, 10 Dec 2020 07:04:04 -0800 (PST) Received: from xps.home (unknown [IPv6:2a01:e35:2fb5:1510:1626:c942:e0f1:c77c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aferraris) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7D8ED1F458F1; Thu, 10 Dec 2020 15:04:02 +0000 (GMT) From: Arnaud Ferraris To: linux-ext4@vger.kernel.org Cc: drosen@google.com, krisman@collabora.com, ebiggers@kernel.org, tytso@mit.edu, Arnaud Ferraris Subject: [PATCH RESEND v2 01/12] tune2fs: Allow enabling casefold feature after fs creation Date: Thu, 10 Dec 2020 16:03:42 +0100 Message-Id: <20201210150353.91843-2-arnaud.ferraris@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210150353.91843-1-arnaud.ferraris@collabora.com> References: <20201210150353.91843-1-arnaud.ferraris@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Gabriel Krisman Bertazi 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 Signed-off-by: Arnaud Ferraris --- misc/tune2fs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index f942c698..0809e565 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| @@ -1513,6 +1514,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.29.2