From: "yukuai (C)" <yukuai3@huawei.com> To: Greg KH <gregkh@linuxfoundation.org> Cc: <stable@vger.kernel.org>, <hughd@google.com>, <viro@zeniv.linux.org.uk>, <yi.zhang@huawei.com>, <zhengbin13@huawei.com>, <houtao1@huawei.com> Subject: Re: [4.19.y PATCH] tmpfs: fix unable to remount nr_inodes from limited to unlimited Date: Thu, 5 Dec 2019 09:22:40 +0800 Message-ID: <bdd3dbd7-e5a1-1ba1-235d-972f726f9ef2@huawei.com> (raw) In-Reply-To: <20191204173334.GB3630950@kroah.com> On 2019/12/5 1:33, Greg KH wrote: > On Wed, Dec 04, 2019 at 09:11:37PM +0800, yu kuai wrote: >> tmpfs support 'size', 'nr_blocks' and 'nr_inodes' mount options. mount or >> remount them to zero means unlimited. 'size' and 'br_blocks' can remount >> from limited to unlimited, while 'nr_inodes' can't. >> >> The problem is fixed since upstream commit 0b5071dd323d (" >> shmem_parse_options(): use a separate structure to keep the results"). But >> in order to backport it, the amount of related patches need to backport is >> huge. >> >> So, I made some local changes to fix the problem. >> >> Signed-off-by: yu kuai <yukuai3@huawei.com> >> --- >> mm/shmem.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/mm/shmem.c b/mm/shmem.c >> index 3c8742655756..966fc69ee8fb 100644 >> --- a/mm/shmem.c >> +++ b/mm/shmem.c >> @@ -3444,7 +3444,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) >> inodes = sbinfo->max_inodes - sbinfo->free_inodes; >> if (percpu_counter_compare(&sbinfo->used_blocks, config.max_blocks) > 0) >> goto out; >> - if (config.max_inodes < inodes) >> + if (config.max_inodes && config.max_inodes < inodes) >> goto out; >> /* >> * Those tests disallow limited->unlimited while any are in use; >> @@ -3460,7 +3460,10 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) >> sbinfo->huge = config.huge; >> sbinfo->max_blocks = config.max_blocks; >> sbinfo->max_inodes = config.max_inodes; >> - sbinfo->free_inodes = config.max_inodes - inodes; >> + if (!config.max_inodes) >> + sbinfo->free_inodes = 0; >> + else >> + sbinfo->free_inodes = config.max_inodes - inodes; >> >> /* >> * Preserve previous mempolicy unless mpol remount option was specified. >> -- >> 2.17.2 >> > > Hm, sorry about my bot, this looked like an odd one-off patch. > > What about 5.3.y, should this patch also go there as well? Yes, 4.4y and 5.3y have the same problem. > > But is it really an issue as this is a new "feature" that 5.4 now has, > can't you just use 5.4.y if you need this type of thing? It's never > worked in the past, right? > It's true that it never worked in the past. I thoult it might be a bug because the behavior is not like what the document said. Thanks for your response. Yu Kuai
prev parent reply index Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-04 13:11 yu kuai 2019-12-04 17:31 ` Greg KH 2019-12-04 17:33 ` Greg KH 2019-12-04 20:13 ` Hugh Dickins 2019-12-05 1:41 ` yukuai (C) 2019-12-05 1:22 ` yukuai (C) [this message]
Reply instructions: You may reply publically to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bdd3dbd7-e5a1-1ba1-235d-972f726f9ef2@huawei.com \ --to=yukuai3@huawei.com \ --cc=gregkh@linuxfoundation.org \ --cc=houtao1@huawei.com \ --cc=hughd@google.com \ --cc=stable@vger.kernel.org \ --cc=viro@zeniv.linux.org.uk \ --cc=yi.zhang@huawei.com \ --cc=zhengbin13@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Stable Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/stable/0 stable/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 stable stable/ https://lore.kernel.org/stable \ stable@vger.kernel.org public-inbox-index stable Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.stable AGPL code for this site: git clone https://public-inbox.org/public-inbox.git