Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp705148pxb; Tue, 5 Apr 2022 19:34:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp0NSrzvnH3UY+fVYJuMfy2iEFFSuwbPd+WG6AP/1vpzT3yZz7p3gdN22UJR4n/Syvr96f X-Received: by 2002:a17:902:b692:b0:14c:935b:2b03 with SMTP id c18-20020a170902b69200b0014c935b2b03mr6384571pls.81.1649212377129; Tue, 05 Apr 2022 19:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649212377; cv=none; d=google.com; s=arc-20160816; b=Wu0WwMnefW10ztBQaa9mF2TxJS9hcaFRa/RJxfxJOBAGMbDbOHow9otKt9hfiEjalr WpbAjufYtIm67LVjXZbpLeBYiZxKbtk9ovmlTHICriQlVDuzqKpgSKaJSKreaGVV9X2q 3JI1om3hW1PZPCyVWvdQ/GC6KQw2S4baSIU3L4A+v2F8aH7XKecGwhsW0Q3jr+VlIiSy BkiRJZBFE82K3zZO2lJr3PULz/Pzrx/snCA0mZs1bdLclW/4gVguw6of75oFk4ceuVZr qr4HRjBLv5qD7hQpCHX2ithiyjdJSudamCy3dtW/VQpgbqMDdPLgt6Jvi3hQE8DkI99O DEng== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tpZjLPv855kn35AK3iUXvsOzb/sWnrDHCqdsYMvTYow=; b=LesP2vjMaV17U5Mx80oPZd46oW5Ze29GJT9DeAguudUiu59K4GpXkXTK7ZeYvpqG/n Co3hvEJpoEI7Dn9TrO6g8SqG7m7zTAEUzR1O2P/r74hjro9GdkgPW1vJG88V+BGVm/8B g6l+RljjG7rW7KMZm5p3IRQIoEXqgeDB/g7Gqi0H0RZNyrq6qpxV4PLOWQIS6bm18m0M vCiXa4EXRv/EilwfnL99J/oaL6TGqz3S4UA80C6j04HOv3e7rByRhaNlTZ3c0TCxGh+6 aDI7ixICIGuFfTEYuKLpFUioKGg7WUxv4K9SGvbgctCpsDpFvQc11+m7TwNNPeIRAvt3 3ShA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xnsH4tVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a63e744000000b0038225bd6f70si14794524pgk.398.2022.04.05.19.32.42; Tue, 05 Apr 2022 19:32:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xnsH4tVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241885AbiDEIf4 (ORCPT + 99 others); Tue, 5 Apr 2022 04:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbiDEH51 (ORCPT ); Tue, 5 Apr 2022 03:57:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 763F0506CC; Tue, 5 Apr 2022 00:51:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A71861728; Tue, 5 Apr 2022 07:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FE2AC34111; Tue, 5 Apr 2022 07:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145083; bh=k107eXAopS3cg/qO3bNvEgkCP2VIeERH0+D1JEhJDRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xnsH4tVNNbdzSIB4YsVs8X/RVUQ+FxqknEF4RwiKAb+F8td5uB0Q61DjBGhVEj6k7 x3nSgGGMxW0FyMVXBOGc8Vy6BKs7b6qjjK+PHvVmY7lqbRRbsO+DAeiYOu7G7WY7bH XddtL30wOLRsOqFr/G55FooUqnm/8JDN5669Yf/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Czerner , Ye Bin , Eric Sandeen , Gabriel Krisman Bertazi , Theodore Tso , Sasha Levin Subject: [PATCH 5.17 0278/1126] ext4: fix remount with abort option Date: Tue, 5 Apr 2022 09:17:05 +0200 Message-Id: <20220405070415.770327618@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Czerner [ Upstream commit e3952fcce1aad934f1322843b564ff86256444b2 ] After commit 6e47a3cc68fc ("ext4: get rid of super block and sbi from handle_mount_ops()") the 'abort' options stopped working. This is because we're using ctx_set_mount_flags() helper that's expecting an argument with the appropriate bit set, but instead got EXT4_MF_FS_ABORTED which is a bit position. ext4_set_mount_flag() is using set_bit() while ctx_set_mount_flags() was using bitwise OR. Create a separate helper ctx_set_mount_flag() to handle setting the mount_flags correctly. While we're at it clean up the EXT4_SET_CTX macros so that we're only creating helpers that we actually use to avoid warnings. Fixes: 6e47a3cc68fc ("ext4: get rid of super block and sbi from handle_mount_ops()") Signed-off-by: Lukas Czerner Cc: Ye Bin Reviewed-by: Eric Sandeen Tested-by: Gabriel Krisman Bertazi Link: https://lore.kernel.org/r/20220201131345.77591-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cd0547fabd79..bed29f96ccc7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2045,8 +2045,8 @@ struct ext4_fs_context { unsigned int mask_s_mount_opt; unsigned int vals_s_mount_opt2; unsigned int mask_s_mount_opt2; - unsigned int vals_s_mount_flags; - unsigned int mask_s_mount_flags; + unsigned long vals_s_mount_flags; + unsigned long mask_s_mount_flags; unsigned int opt_flags; /* MOPT flags */ unsigned int spec; u32 s_max_batch_time; @@ -2149,23 +2149,36 @@ static inline void ctx_set_##name(struct ext4_fs_context *ctx, \ { \ ctx->mask_s_##name |= flag; \ ctx->vals_s_##name |= flag; \ -} \ +} + +#define EXT4_CLEAR_CTX(name) \ static inline void ctx_clear_##name(struct ext4_fs_context *ctx, \ unsigned long flag) \ { \ ctx->mask_s_##name |= flag; \ ctx->vals_s_##name &= ~flag; \ -} \ +} + +#define EXT4_TEST_CTX(name) \ static inline unsigned long \ ctx_test_##name(struct ext4_fs_context *ctx, unsigned long flag) \ { \ return (ctx->vals_s_##name & flag); \ -} \ +} -EXT4_SET_CTX(flags); +EXT4_SET_CTX(flags); /* set only */ EXT4_SET_CTX(mount_opt); +EXT4_CLEAR_CTX(mount_opt); +EXT4_TEST_CTX(mount_opt); EXT4_SET_CTX(mount_opt2); -EXT4_SET_CTX(mount_flags); +EXT4_CLEAR_CTX(mount_opt2); +EXT4_TEST_CTX(mount_opt2); + +static inline void ctx_set_mount_flag(struct ext4_fs_context *ctx, int bit) +{ + set_bit(bit, &ctx->mask_s_mount_flags); + set_bit(bit, &ctx->vals_s_mount_flags); +} static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) { @@ -2235,7 +2248,7 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) param->key); return 0; case Opt_abort: - ctx_set_mount_flags(ctx, EXT4_MF_FS_ABORTED); + ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED); return 0; case Opt_i_version: ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20"); -- 2.34.1