Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp461602pxu; Wed, 14 Oct 2020 06:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaukxpuTE+vvLxxMz0SDEgcj7TEeQLBp099IatxpJ0TGZN+73Pmu0RBRP49x5ktKZY/HaU X-Received: by 2002:a05:6402:1ad9:: with SMTP id ba25mr5244915edb.120.1602680405294; Wed, 14 Oct 2020 06:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602680405; cv=none; d=google.com; s=arc-20160816; b=v3Su7rFLccDLZTVhik3uc+MNjprNj7QabY2pBHyWn1gmPHmLDTaA0T3mySSWLqfJhZ LOG22bLwl81DzIsBEVULMsBAPHC1ZiICgQza4lh5+cceppie9QCcITrqHranCkw78/vg L2OSqUQwpB+DigtAKAOlZyKhgB3zr0aYH50Wstxkk8GrpvH74osr9LmztTbLQ2A2R9WM RdEtfT4HK4hdBOndBANrZW2q3XI6fuVVKg/4OsczJZ9iZe5iFx043dnaNsQp5YzcUWnp VYJd0y69aRuGEF2Rs/lTzw8LPdnOXesu45iVl00PuB0D65KY3hP274NpUsO8PGb67klN 3UAQ== 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 :message-id:date:subject:cc:to:from; bh=JLu1kDj0LU4YKZUNT7+CW0Oj+3lv8VMQXsufB/Mw7Y0=; b=j1jLo4Irbw2/RdDPSxamgq2g7cr0BSRFWk8jxm3Rp7OM/nR/rzKuNWC6PUJZr5CBwk qIEx1tRovQ+2Vul+fujrmwwZTmfLGQAGoBWNdq//59e4lt10a7QjFZqXzFiuwcKCpaIB nBQAqg4/DQnsuqyXleG6CIkZ1t3n3pO25ITbdOk/nAa9icCfJDbr8vyDhoCOVgtxMF4N SaloBuT9eOATSVnEwh2Pb2BhGjT6l6wRvObeg6GmJmmiZFhZsssv3rzmcNl89aEGHxya MKFVn5IrEHMatWBRRclffFMqzEng3tK2Sy3PoH8GDQALtNWnWLrHCv04mYVLpYsLG3Dr gI1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si2426292edq.410.2020.10.14.05.59.42; Wed, 14 Oct 2020 06:00:05 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727753AbgJNGy5 (ORCPT + 99 others); Wed, 14 Oct 2020 02:54:57 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:15285 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727622AbgJNGy5 (ORCPT ); Wed, 14 Oct 2020 02:54:57 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C64E4B931C5AF29CDE4B; Wed, 14 Oct 2020 14:54:51 +0800 (CST) Received: from DESKTOP-FKFNUOQ.china.huawei.com (10.67.101.50) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 14 Oct 2020 14:54:45 +0800 From: Zhe Li To: , CC: , , , , , , Subject: [PATCH 1/2] jffs2: fix ignoring mounting options problem during remounting Date: Wed, 14 Oct 2020 14:54:42 +0800 Message-ID: <20201014065443.18512-1-lizhe67@huawei.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.101.50] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: lizhe 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? Signed-off-by: lizhe --- fs/jffs2/super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 05d7878dfad1..4fd297bdf0f3 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -215,11 +215,28 @@ static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) 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); } -- 2.12.3