From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753038AbdKWOGD (ORCPT ); Thu, 23 Nov 2017 09:06:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:39328 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbdKWOGC (ORCPT ); Thu, 23 Nov 2017 09:06:02 -0500 Date: Thu, 23 Nov 2017 15:06:00 +0100 From: Michal Hocko To: Tetsuo Handa 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 Message-ID: <20171123140600.kchjwercnkxc2xjb@dhcp22.suse.cz> References: <20171123124541.sjdkavie47wfahrs@dhcp22.suse.cz> <20171123125345.exih2j4jv4shn3yz@dhcp22.suse.cz> <20171123125626.GD6324@quack2.suse.cz> <201711232235.CDI34369.FLOtQVHFSJOOMF@I-love.SAKURA.ne.jp> <20171123134629.ba5fzofrq37tmt7n@dhcp22.suse.cz> <201711232257.BFA41889.LOVOtFHFQJOSMF@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201711232257.BFA41889.LOVOtFHFQJOSMF@I-love.SAKURA.ne.jp> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 23-11-17 22:57:06, Tetsuo Handa wrote: > 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? It is s_umount lock but that one is alreay held at the point where you suggested register_shrinker. My bad, I could have noticed that. Feel free to take over and send a patch. Considering I've screwed several times already I do not feel I am the right one to send the fix. -- Michal Hocko SUSE Labs