All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: syzbot+d2586fde8fdcead3647f@syzkaller.appspotmail.com,
	viro@ZenIV.linux.org.uk, hughd@google.com,
	syzkaller-bugs@googlegroups.com, linux-mm@kvack.org,
	Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH] shmem: don't call put_super() when fill_super() failed.
Date: Tue, 15 May 2018 09:27:35 +0900	[thread overview]
Message-ID: <201805150027.w4F0RZ27055056@www262.sakura.ne.jp> (raw)
In-Reply-To: <20180514171154.GB252575@gmail.com>

Eric Biggers wrote:
> > I'm not following, since generic_shutdown_super() only calls ->put_super() if
> > ->s_root is set, which only happens at the end of shmem_fill_super().  Isn't the
> > real problem that s_shrink is registered too early, causing super_cache_count()
> > and shmem_unused_huge_count() to potentially run before shmem_fill_super() has
> > completed?  Or alternatively, the problem is that super_cache_count() doesn't
> > check for SB_ACTIVE.
> > 
> 
> Coincidentally, this is already going to be fixed by commit 79f546a696bff259
> ("fs: don't scan the inode cache before SB_BORN is set") in vfs/for-linus.
> 

Just an idea, but if shrinker registration is too early, can't we postpone it
like below?

--- a/fs/super.c
+++ b/fs/super.c
@@ -521,7 +521,6 @@ struct super_block *sget_userns(struct file_system_type *type,
 	hlist_add_head(&s->s_instances, &type->fs_supers);
 	spin_unlock(&sb_lock);
 	get_filesystem(type);
-	register_shrinker_prepared(&s->s_shrink);
 	return s;
 }
 
@@ -1287,6 +1286,7 @@ struct dentry *
 	WARN((sb->s_maxbytes < 0), "%s set sb->s_maxbytes to "
 		"negative value (%lld)\n", type->name, sb->s_maxbytes);
 
+	register_shrinker_prepared(&sb->s_shrink);
 	up_write(&sb->s_umount);
 	free_secdata(secdata);
 	return root;
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -313,6 +313,7 @@ int prealloc_shrinker(struct shrinker *shrinker)
 	shrinker->nr_deferred = kzalloc(size, GFP_KERNEL);
 	if (!shrinker->nr_deferred)
 		return -ENOMEM;
+	INIT_LIST_HEAD(&shrinker->list);
 	return 0;
 }
 

  parent reply	other threads:[~2018-05-15  0:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  6:57 [PATCH] shmem: don't call put_super() when fill_super() failed Tetsuo Handa
2018-05-14 17:04 ` Eric Biggers
2018-05-14 17:11   ` Eric Biggers
2018-05-14 18:07     ` Al Viro
2018-05-14 20:59     ` Tetsuo Handa
2018-05-15  0:27     ` Tetsuo Handa [this message]
2018-05-15  0:39       ` Al Viro
2018-05-15  0:52         ` Tetsuo Handa
2018-05-15  1:13           ` Al Viro

Reply instructions:

You may reply publicly 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=201805150027.w4F0RZ27055056@www262.sakura.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=dchinner@redhat.com \
    --cc=ebiggers3@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+d2586fde8fdcead3647f@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.