Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9095774pxu; Mon, 28 Dec 2020 06:32:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxK8Hr3Fg422azbviTb41ixR7t6jk6XQIcpWeEuqHYDYSztCUC1ZZFWPefRWekNdQCuUPvn X-Received: by 2002:aa7:cc15:: with SMTP id q21mr42657952edt.213.1609165926860; Mon, 28 Dec 2020 06:32:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165926; cv=none; d=google.com; s=arc-20160816; b=ER0AJYsT4RPf4OZDLmQSi4xv3pscIGqYZY+twpISIFYAeM1IQijPGBco5G1J1uzCtx PWYIWwosQiXS1FXez6Hh4pxYJBSnLdXwBGXu3jgemSiz4DHgzvGhZhWMP4IiahvTj7yr tZEOSAMGCXnbfz+1rRZSFHLA2LfWcOcZIXsyXcyZqz56iwDz5wHofwHqujRWNkc6v+Qr IWde35tK1oY0x5YchDG9UFRBR3lEDuIGG/IMKUGJFyVjLdpA/uBabdILvnHPJPeftosQ FlWJbKP5/Glk4zzXSNNrcO/2lhYgRT7F64195kyfejb/u4bCVYdq+naO2xvBdMqMGIkC VHEg== 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=dr3K3IIerE4V5NDlZiKyBji2RgiJwe2FKLkb1p2MgxU=; b=X6wt84vRFkCIinLzsP8oEl+ggCglotr/W7ThWmopefwyzCjpXY0LfVOXdPVCXsTYgK wd+/9WQ6CepbhJfXy5GfWenaL5yWnxgeyBm83GH1SEnOveoFa41EPAFxeUlShbUrqia5 uxv/2sO/QCAqPD4BVMytaWTpLnQsMXF+aT5LVBdZ9iLB//92Keh7r6NJ1EKSJOw7ZhKq Zfk/ZSWacmgvxwRgDkvw6ipD7mGAzh1maCYyXMcYVFWSOJabnOz2rnsAueCyzLSzUFRz xzTkoENSzsDiWKWkGOYG+qgHWBGJuJdkMTKcPZAwkZRPP6xFAFCobi4yQMwoCpbVK6Lp HsDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZcDPTA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si19597470eds.16.2020.12.28.06.31.43; Mon, 28 Dec 2020 06:32:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZcDPTA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503525AbgL1O3R (ORCPT + 99 others); Mon, 28 Dec 2020 09:29:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:36958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503453AbgL1O3O (ORCPT ); Mon, 28 Dec 2020 09:29:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFC2820715; Mon, 28 Dec 2020 14:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165713; bh=bLXY2QJ8ravuJUg6Jp4AGdYctMCvagFpq6R7cFlUvaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZcDPTA5X//fnvpXKY+XBT0tpqJBrGetwA79jfiWUXfYeTIZNUOm2BGogUGkWqjSn ysJMezO4Stzxk1fUSsZsoAA6mUd3DSfWljb7YbLYpzoZC0HxKBGa4qQDpoNj5ev69r AgPXtT1Fr0kkJf94Zd4J4DeNKfw88zbxpoQWNiNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, lizhe , Richard Weinberger Subject: [PATCH 5.10 628/717] jffs2: Fix ignoring mounting options problem during remounting Date: Mon, 28 Dec 2020 13:50:26 +0100 Message-Id: <20201228125051.008707227@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: lizhe commit 08cd274f9b8283a1da93e2ccab216a336da83525 upstream. The jffs2 mount options will be ignored when remounting jffs2. It can be easily reproduced with the steps listed below. 1. mount -t jffs2 -o compr=none /dev/mtdblockx /mnt 2. mount -o remount compr=zlib /mnt Since ec10a24f10c8, the option parsing happens before fill_super and then pass fc, which contains the options parsing results, to function jffs2_reconfigure during remounting. But function jffs2_reconfigure do not update c->mount_opts. This patch add a function jffs2_update_mount_opts to fix this problem. By the way, I notice that tmpfs use the same way to update remounting options. If it is necessary to unify them? Cc: Fixes: ec10a24f10c8 ("vfs: Convert jffs2 to use the new mount API") Signed-off-by: lizhe Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/jffs2/super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -215,11 +215,28 @@ static int jffs2_parse_param(struct fs_c return 0; } +static inline void jffs2_update_mount_opts(struct fs_context *fc) +{ + struct jffs2_sb_info *new_c = fc->s_fs_info; + struct jffs2_sb_info *c = JFFS2_SB_INFO(fc->root->d_sb); + + mutex_lock(&c->alloc_sem); + if (new_c->mount_opts.override_compr) { + c->mount_opts.override_compr = new_c->mount_opts.override_compr; + c->mount_opts.compr = new_c->mount_opts.compr; + } + if (new_c->mount_opts.rp_size) + c->mount_opts.rp_size = new_c->mount_opts.rp_size; + mutex_unlock(&c->alloc_sem); +} + static int jffs2_reconfigure(struct fs_context *fc) { struct super_block *sb = fc->root->d_sb; sync_filesystem(sb); + jffs2_update_mount_opts(fc); + return jffs2_do_remount_fs(sb, fc); }