All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@kernel.org
Cc: jack@suse.cz, viro@zeniv.linux.org.uk, david@fromorbit.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] fs: handle shrinker registration failure in sget_userns
Date: Thu, 23 Nov 2017 22:57:06 +0900	[thread overview]
Message-ID: <201711232257.BFA41889.LOVOtFHFQJOSMF@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20171123134629.ba5fzofrq37tmt7n@dhcp22.suse.cz>

Michal Hocko wrote:
> > @@ -260,9 +261,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
> >  	s->s_shrink.count_objects = super_cache_count;
> >  	s->s_shrink.batch = 1024;
> >  	s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE;
> > -	INIT_LIST_HEAD(&s->s_shrink.list);
> > -	return s;
> > -
> > +	if (register_shrinker(&s->s_shrink) == 0)
> > +		return s;
> >  fail:
> >  	destroy_unused_super(s);
> >  	return NULL;
> 
> But I am not sure this is correct. So what protects shrinker invocation
> while the object is not initialized yet?

Then, what protects shrinker invocation in your patch?
Your patch is calling register_shrinker() immediately after
alloc_super() succeeds. My patch just moved register_shrinker()
into alloc_super().

@@ -503,6 +512,10 @@ struct super_block *sget_userns(struct file_system_type *type,
 		s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns);
 		if (!s)
 			return ERR_PTR(-ENOMEM);
+		if (register_shrinker(&s->s_shrink)) {
+			destroy_unused_super(s);
+			return ERR_PTR(-ENOMEM);
+		}
 		goto retry;
 	}
 

  reply	other threads:[~2017-11-23 13:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 11:52 [PATCH] fs: handle shrinker registration failure in sget_userns Michal Hocko
2017-11-23 12:26 ` Jan Kara
2017-11-23 12:45   ` Michal Hocko
2017-11-23 12:53     ` Michal Hocko
2017-11-23 12:56       ` Jan Kara
2017-11-23 13:35         ` Tetsuo Handa
2017-11-23 13:46           ` Michal Hocko
2017-11-23 13:57             ` Tetsuo Handa [this message]
2017-11-23 14:06               ` Michal Hocko
2017-11-23 14:10                 ` Tetsuo Handa
2017-11-23 14:35 ` [PATCH v2] " Michal Hocko
2017-11-23 14:55   ` Al Viro
2017-11-23 15:02     ` Michal Hocko
2017-11-23 15:34       ` Michal Hocko
2017-11-23 15:04     ` [PATCH v2] fs: handle shrinker registration failure insget_userns Tetsuo Handa
2017-11-23 15:28       ` Al Viro
2017-11-23 15:35         ` [PATCH v2] fs: handle shrinker registration failure in sget_userns Tetsuo Handa
2017-11-23 15:44           ` Al Viro
2017-11-23 21:51             ` Tetsuo Handa
2017-11-24  7:48               ` Michal Hocko
2017-11-29 11:55     ` Michal Hocko
2017-12-09 20:59       ` Al Viro
2017-12-09 21:54         ` Al Viro
2017-12-10  2:33           ` Tetsuo Handa
2017-12-10 10:05             ` Michal Hocko
2017-12-10 15:21               ` Al Viro
2017-11-23 14:47 ` [PATCH] " Al Viro
2017-11-23 15:00   ` Michal Hocko

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=201711232257.BFA41889.LOVOtFHFQJOSMF@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --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.