Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13926603pxu; Mon, 4 Jan 2021 08:09:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOC2ZDKc7STYTodRc+trF0ocj717Krebcc2fwpo67H5hw9bmpWOaZuxqLw7KPQ6YXsrRtj X-Received: by 2002:a17:906:1741:: with SMTP id d1mr58195488eje.182.1609776556320; Mon, 04 Jan 2021 08:09:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609776556; cv=none; d=google.com; s=arc-20160816; b=IUt5r8MEoS0xbWz/JuAowL62r9YUw5hplsC8HczZcHegJ4a+FvEo2xY8cB40n8NJvE s+NaFUDCLAF3VFcLZ+rwCLLNqaQYVpMvRfET02Ki+Ddc0fmpSy2IvPENI0lZAgiRkIpw 3t0QR4aL2/nmWt8m8oLSHmpiLkGbBNunx+VWsXUfibQWaSAkMROdYcFJafFcBxq1WdW/ 3GHtYatCNrBePUAqDUQ4Uj3MY8IiPkvLBqx9hhiK/6xd4Dx7rXmMdHwL4Ntx9I4V+bJ3 tzbP6/KMJ+3iFS+40lZEQXFt7TGhXCTTnHdJCcSQUmcq+Htdrqz6bnND8Og3isSQgKCu nQ/A== 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=M05N6q8Iyi8bTTN7mdODNFe/SkmsbrDtD6d1RjoWzh8=; b=U25ubYhjeryHbQtzv1Za+a4GUV/24Ay0+w503zGVHi0zJIF27pIU23n0sfGPR/XDJT hDXpNh0e76CuEXg+iWnqbch6h7dYmvcZXi7LdcI4nqeMeSwagqqMRT6zQCxwLdO2pafh dlrI7N+1869QdbggEmmzUOrUSK/4O+AB08IZggyz8mgOO8Xgeof7BgCA/AGxMgmILQzi lhnLbM3FUt9A44oHryBb3DLbg7vzh85Z98+58MI3eDLl9MeuoDgB+RbyI+XHgJi5dBME SihIiP9KUZ5OUO9hjX+awXz+uSzrC4TNiE7NvwtstCeG31N2KfFZ592zl+BlHWaW80nl nxkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wb3DrWAJ; 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 cq3si31740523edb.72.2021.01.04.08.08.52; Mon, 04 Jan 2021 08:09:16 -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=wb3DrWAJ; 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 S1728153AbhADQGZ (ORCPT + 99 others); Mon, 4 Jan 2021 11:06:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:40366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728958AbhADQC6 (ORCPT ); Mon, 4 Jan 2021 11:02:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD0B52245C; Mon, 4 Jan 2021 16:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609776138; bh=3Cv24Vu//k+9LqcI5Km3zQxhoyl+adOYlUF9njqT6t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wb3DrWAJKnHF3aZatQ+CFfriKhIWyskfxtL9Hf0NySLdkK2VyruXionv5uUaruimC 61mo9ELsLyhgS7k6mD7N6U1GtXNVLALD8i9KNDnNa1s3n7O+C7d6R0eMtcSG3CWC5Y 9jjsukpywN2pXNcoTk5kcmMTTiFEWquY+f/axvMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jubin Zhong , lizhe , Richard Weinberger , Sasha Levin Subject: [PATCH 5.10 08/63] jffs2: Allow setting rp_size to zero during remounting Date: Mon, 4 Jan 2021 16:57:01 +0100 Message-Id: <20210104155709.212682044@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210104155708.800470590@linuxfoundation.org> References: <20210104155708.800470590@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 [ Upstream commit cd3ed3c73ac671ff6b0230ccb72b8300292d3643 ] Set rp_size to zero will be ignore during remounting. The method to identify whether we input a remounting option of rp_size is to check if the rp_size input is zero. It can not work well if we pass "rp_size=0". This patch add a bool variable "set_rp_size" to fix this problem. Reported-by: Jubin Zhong Signed-off-by: lizhe Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- fs/jffs2/jffs2_fs_sb.h | 1 + fs/jffs2/super.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h index 778275f48a879..5a7091746f68b 100644 --- a/fs/jffs2/jffs2_fs_sb.h +++ b/fs/jffs2/jffs2_fs_sb.h @@ -38,6 +38,7 @@ struct jffs2_mount_opts { * users. This is implemented simply by means of not allowing the * latter users to write to the file system if the amount if the * available space is less then 'rp_size'. */ + bool set_rp_size; unsigned int rp_size; }; diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 4fd297bdf0f3f..c523adaca79f3 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -88,7 +88,7 @@ static int jffs2_show_options(struct seq_file *s, struct dentry *root) if (opts->override_compr) seq_printf(s, ",compr=%s", jffs2_compr_name(opts->compr)); - if (opts->rp_size) + if (opts->set_rp_size) seq_printf(s, ",rp_size=%u", opts->rp_size / 1024); return 0; @@ -206,6 +206,7 @@ static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) if (opt > c->mtd->size) return invalf(fc, "jffs2: Too large reserve pool specified, max is %llu KB", c->mtd->size / 1024); + c->mount_opts.set_rp_size = true; c->mount_opts.rp_size = opt; break; default: @@ -225,8 +226,10 @@ static inline void jffs2_update_mount_opts(struct fs_context *fc) 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) + if (new_c->mount_opts.set_rp_size) { + c->mount_opts.set_rp_size = new_c->mount_opts.set_rp_size; c->mount_opts.rp_size = new_c->mount_opts.rp_size; + } mutex_unlock(&c->alloc_sem); } -- 2.27.0