Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp605856pxb; Thu, 5 Nov 2020 08:19:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcc4t1weqMq7hpHumPUsGTlD9Fu47kWl9p/s9edOCjtGRD/C4fp228RWaxHdUoHzNYir0+ X-Received: by 2002:a17:906:d8b0:: with SMTP id qc16mr3018977ejb.268.1604593160907; Thu, 05 Nov 2020 08:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604593160; cv=none; d=google.com; s=arc-20160816; b=jTyzMBV88v5l2adNy+w6/k0M0EHVr2RJ6bXuD2kFWwan+PpJOMtgQYXSvP0txTDkuV /FZ3/IvfosQEUe5JC8x+U3oDhzNbhDfsab6CAf2a6ua0/V3cDmyJOu2UxYWrAWbcM0Zd 437umnvEU54qNZ95+ldH+RS1Vm9FFJpDtx3Spvlpe3to1Mjht8sgkjuoSR/lgjKT+IQ0 BboqFH7Zx1tBuov4vvq6PsuDd7t65xkQNUxc+Itn9ZDVYdnmhThSJ4ozh2S1eh1cqDhe Ig6BMKokXB/uAbuJFzXHaTIp0hQvsPAg1P4D41XXeTc8rrXQXmTmFzxDw1e6kJOEyHy3 Ubfg== 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=jCLYVENSmdQKT9UYgB28HLv80A0j0nYLHTlj5YrnuqM=; b=PXvygO3ivgiLN+yjFWr2MCSfLR8V1baaOdeFxwofMdGSpxV+SA82OiMXxmEnRLFpAJ KuYvwKt4ZFsGwVHfZ/jdPg6sRwnah+zBZH5lnWWWANn1hgj0Ep/V3bvYSqb3NEnKSzci /lwqUOJCjDC/iSGW0P5URayEiaAiz3f1n2YW8vNKnqtwUBUTE1NR64Eu+U6faxeMkszZ Pl7Ba1SB4G9qs/IYBDIBA6bE7qCll2/NBSqDrnOa7MG9NZFzpXfsrIGeli0r6xGReVT1 1A+NtDovE4aGOawSTsXJGw8KSslpXUUAE30ZXkNRvG9oISYE04xtNx9HNXtlseEvLMTh LuPw== 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 e26si1471417ejc.81.2020.11.05.08.18.57; Thu, 05 Nov 2020 08:19:20 -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 S1726371AbgKEQSN (ORCPT + 99 others); Thu, 5 Nov 2020 11:18:13 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:49724 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725998AbgKEQR7 (ORCPT ); Thu, 5 Nov 2020 11:17:59 -0500 Received: from xps.home (unknown [IPv6:2a01:e35:2fb5:1510:4a7e:bc14:686e:75db]) (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 0F6561F4611B; Thu, 5 Nov 2020 16:17:58 +0000 (GMT) From: Arnaud Ferraris To: linux-ext4@vger.kernel.org Cc: Gabriel Krisman Bertazi , Arnaud Ferraris Subject: [PATCH 01/11] tune2fs: Allow enabling casefold feature after fs creation Date: Thu, 5 Nov 2020 17:16:33 +0100 Message-Id: <20201105161642.87488-2-arnaud.ferraris@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201105161642.87488-1-arnaud.ferraris@collabora.com> References: <20201105161642.87488-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.28.0