Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2287165iof; Wed, 8 Jun 2022 01:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTkoU0d3Iv/Ba124QWn/tCe58UgVyrP6fLzrqFmDJw4qj03iWPmG1phCRYiy29otuy0Qua X-Received: by 2002:a17:90b:3696:b0:1e6:6f6d:962b with SMTP id mj22-20020a17090b369600b001e66f6d962bmr38470457pjb.8.1654676936859; Wed, 08 Jun 2022 01:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676936; cv=none; d=google.com; s=arc-20160816; b=wfvwxNVPZPXV3tNXp86mV9a82eB2UZDgtemP9a5qb8dBcUicp97UizAsP/TUNGO9e4 XD0rIbzLXEJOoGZu21MYZSQBJOg+mrdB+cn0UDLS1l7JwY16iz0lZrVuq09I0T9bcldX nTCwyhiWAsqEc6sfqf4iuu0ffpSYFJpQelcSDyCj3o2m+48nDtR07cZPN/w3Mr1byuNA 8vXMLSHWbqWA4Y4GdTQBCHRysCY+wwDhKkZvwyX19Z03Zy9+kbTAwvzmBm+M0AAAhcsV ILmQhafWRuKeZsKz0N7BnQANvhbMi7rqczHMdhTVPg2NGGBDtZuurCdojANaYD5zzzgp JDeQ== 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=rv4+MWxD6/KFJIPvx/+DWqpj5Hkx4DM/F4jOcGjBPOc=; b=avbj3JGdtMEYl2Lq1VuxBwvoxR6SEM6MsvKorcicKYoYGzofnMPt4bKzTQczkWnsWT 2v9JeeNUdG/Ptsajt3MS/15vQaXGBaD9W86r0udjrxTXecl5GDlzRjon6O2kjQDVYI8V CCuTQyC9SadtETcxkRRrYthGf2N1NAP7yVGJ1XaeUdBGh9n6U8SpLd6VXPKqPF+8MBwz pFASVp6r2X6MLEcEtFcSe+c9pMxUyxqOrlMnRmR2NgsHTJzLqAjnRXXFaieoXxePjbdo Hr5jXiRTezWhJP1S/R0xmFOhYhAVdqlIZUF97IsAJ/P8DT5vpwtCLEf7Gs0wWCR93FH7 mp/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g3jxhMhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w14-20020a056a0014ce00b004fa3a8e001asi30389473pfu.209.2022.06.08.01.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:28:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g3jxhMhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45FC322CEE1; Wed, 8 Jun 2022 00:57:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380882AbiFGVix (ORCPT + 99 others); Tue, 7 Jun 2022 17:38:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376610AbiFGUpr (ORCPT ); Tue, 7 Jun 2022 16:45:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680771F589C; Tue, 7 Jun 2022 11:39:26 -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 8CDAB6159D; Tue, 7 Jun 2022 18:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97DA9C385A5; Tue, 7 Jun 2022 18:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627160; bh=pJleXnQAqwEM7iZbJoC8qGeIQitwSn577DxdbRHysLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3jxhMhZ3Z25g4KwKmUHem3g4s1iq0dOWFEfdnUtQVb9TXh15Kes3q/fb5wdulVL2 iof9LV9flZkNlrs+3jCP6ON1a4j46d1pbIYKVcAUec9FYGtWpBK202yoD1xO4XBM5n T6zobqBMsQOrBVNi8XVxXhxe56oTBeLjB9HvE/LE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ojaswin Mujoo , Ritesh Harjani , Theodore Tso , stable@kernel.org Subject: [PATCH 5.17 638/772] ext4: fix journal_ioprio mount option handling Date: Tue, 7 Jun 2022 19:03:50 +0200 Message-Id: <20220607165007.734891467@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Ojaswin Mujoo commit e4e58e5df309d695799c494958962100a4c25039 upstream. In __ext4_super() we always overwrote the user specified journal_ioprio value with a default value, expecting parse_apply_sb_mount_options() to later correctly set ctx->journal_ioprio to the user specified value. However, if parse_apply_sb_mount_options() returned early because of empty sbi->es_s->s_mount_opts, the correct journal_ioprio value was never set. This patch fixes __ext4_super() to only use the default value if the user has not specified any value for journal_ioprio. Similarly, the remount behavior was to either use journal_ioprio value specified during initial mount, or use the default value irrespective of the journal_ioprio value specified during remount. This patch modifies this to first check if a new value for ioprio has been passed during remount and apply it. If no new value is passed, use the value specified during initial mount. Signed-off-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani Tested-by: Ritesh Harjani Link: https://lore.kernel.org/r/20220418083545.45778-1-ojaswin@linux.ibm.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4394,7 +4394,8 @@ static int __ext4_fill_super(struct fs_c int silent = fc->sb_flags & SB_SILENT; /* Set defaults for the variables that will be set during parsing */ - ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO; + if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO)) + ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO; sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS; sbi->s_sectors_written_start = @@ -6261,7 +6262,6 @@ static int __ext4_remount(struct fs_cont char *to_free[EXT4_MAXQUOTAS]; #endif - ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO; /* Store the original options */ old_sb_flags = sb->s_flags; @@ -6287,9 +6287,14 @@ static int __ext4_remount(struct fs_cont } else old_opts.s_qf_names[i] = NULL; #endif - if (sbi->s_journal && sbi->s_journal->j_task->io_context) - ctx->journal_ioprio = - sbi->s_journal->j_task->io_context->ioprio; + if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO)) { + if (sbi->s_journal && sbi->s_journal->j_task->io_context) + ctx->journal_ioprio = + sbi->s_journal->j_task->io_context->ioprio; + else + ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO; + + } ext4_apply_options(fc, sb);