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@xxxxxxxxxx> > --- > 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? 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? thanks, greg k-h