Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7193124ybf; Fri, 6 Mar 2020 12:12:41 -0800 (PST) X-Google-Smtp-Source: ADFU+vuRqk+hfEzeik8KzjpHGqtGSlsLAm63yxA5mc8w7ArtzIhm0dnkvpsRTF8k93cJW+1y2equ X-Received: by 2002:a05:6830:1e46:: with SMTP id e6mr3879125otj.257.1583525561276; Fri, 06 Mar 2020 12:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583525561; cv=none; d=google.com; s=arc-20160816; b=0ycu1u2E3nnYZaw1grCnetGJaDCOtk5kbibLoItM65b89slfxc1jXEcv4Fbdzz7CJ8 /E8bZsVcHtyAbgLTpioGERMDHfibITiHTEBUFeKtyk18iYHK1NBMmuXkumstabft4mTT Z5WBLqNlsXszsKCHT7qjFLel7pt6abVSdrrsL+nf0FjvzN8PnB/QrgEo1l/BqcZo/cgl MjQzW/fgfXA1FpeLjQkcoOqcfGMdCAsp2nNwbc3Gy/NZxKlc9dN//YIYrJFvv8nl5E7K U+xgTrC2nO1BJirZYm40feKC4PKTvinMGKP9SmV4HIARhnrGD/zcWXxLS7zEUR3QypkR XYxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uGhnsFojeYVgmT7TeltZeDT7YJ6kcqoR7qP83JoZDq8=; b=zWanBTdXVBeT0g8wb8IfXlCcTiCeWj71qgnLHltDDj3dixaox7lRgBmX5FatrX9wMm +TgPrd5QfGC2AjCqeVwC4esOL5pKcjlIY9RjeGLTJF1cVseDnuobE15Q271uf9o3I/hZ P1ZeZxh88FtdRqUrr1ueK04WIbPG5a2P6l95Fn62RB9erMZeukvDtEZIMawiBTGbR+mt p6yOFdC0G8Gxbghm7ilaZamEDaQNlTeR0d7+WkhIA3fCbNv7Lru7zw6dGFjKeaieADRL HhXP6c96RnqvJ9OwwH2cMd5XivVzARRbdsCQ8TstMJ/70otQsCfh3SShW8EgIO81n2SW joeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=CfCt62Ls; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si252044oie.63.2020.03.06.12.12.29; Fri, 06 Mar 2020 12:12:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=CfCt62Ls; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726237AbgCFUL5 (ORCPT + 99 others); Fri, 6 Mar 2020 15:11:57 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:46245 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbgCFUL5 (ORCPT ); Fri, 6 Mar 2020 15:11:57 -0500 Received: by mail-io1-f68.google.com with SMTP id f3so3285386ioc.13 for ; Fri, 06 Mar 2020 12:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGhnsFojeYVgmT7TeltZeDT7YJ6kcqoR7qP83JoZDq8=; b=CfCt62LsFryGf6XAIckG0NHQAEF/JWpNRvEH5io6jCC1OozpOAfmnwMJVh8/b3Ye8D bHl8CuLt8I/Yaa22343ubc4bKJ8ViDo8o5QJWvc2GKzGU8DIx2OEH9G115Np6QyRFTNV H3+9zS2erYPZvp4+Gox0lwRnRuO94El5PeNRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGhnsFojeYVgmT7TeltZeDT7YJ6kcqoR7qP83JoZDq8=; b=KP+cGJepTqZXwicVQmSPPhVn5ZfaOv5p9n+uv6dCoxpPvbfnkfpUEa6QxAR+CiTSZq H6oMF77Zy/WI0bh/9IoDQb1sNj5rI3yEhmY4XjBO9ewNwh+Ch4eOKgr2k67CHEYuLvBy zdhkZLfnygdHESkRvbrRwTzEHxHUSSybD4zD/T9Md38NPHkf0g6LznpYBK0815UdTuUV JnB8a9WVmutaYt7fxRqW9kgCGMx18sHHwn7LK7hC4bUAv7LtNjrU7aAMyJy7i3ttAXw/ +Nl+CVrr0rCpmRkoAca1sVoyYNTgnWdAjcejCEsxByiUKz5S8W1UOduNMVwm/dF7Mp6z XZMQ== X-Gm-Message-State: ANhLgQ0u9EikbRlgrS4EJVOr7T9TcxLXmuZpvPK6axhiwaw5n/NSmYq3 SCCxzNDYh4+lym+usWIFLS9zFjY0h0n8DIcjdYL7gw== X-Received: by 2002:a02:6a10:: with SMTP id l16mr4545028jac.77.1583525515096; Fri, 06 Mar 2020 12:11:55 -0800 (PST) MIME-Version: 1.0 References: <1582644535.3361.8.camel@HansenPartnership.com> <20200228155244.k4h4hz3dqhl7q7ks@wittgenstein> <107666.1582907766@warthog.procyon.org.uk> <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> <20200306162549.GA28467@miu.piliscsaba.redhat.com> <20200306194322.GY23230@ZenIV.linux.org.uk> <20200306195823.GZ23230@ZenIV.linux.org.uk> <20200306200522.GA23230@ZenIV.linux.org.uk> In-Reply-To: <20200306200522.GA23230@ZenIV.linux.org.uk> From: Miklos Szeredi Date: Fri, 6 Mar 2020 21:11:43 +0100 Message-ID: Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] To: Al Viro Cc: Ian Kent , David Howells , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 6, 2020 at 9:05 PM Al Viro wrote: > > On Fri, Mar 06, 2020 at 07:58:23PM +0000, Al Viro wrote: > > On Fri, Mar 06, 2020 at 07:43:22PM +0000, Al Viro wrote: > > > On Fri, Mar 06, 2020 at 05:25:49PM +0100, Miklos Szeredi wrote: > > > > On Tue, Mar 03, 2020 at 08:46:09AM +0100, Miklos Szeredi wrote: > > > > > > > > > > I'm doing a patch. Let's see how it fares in the face of all these > > > > > preconceptions. > > > > > > > > Here's a first cut. Doesn't yet have superblock info, just mount info. > > > > Probably has rough edges, but appears to work. > > > > > > For starters, you have just made namespace_sem held over copy_to_user(). > > > This is not going to fly. > > > > In case if the above is too terse: you grab your mutex while under > > namespace_sem (see attach_recursive_mnt()); the same mutex is held > > while calling dir_emit(). Which can (and normally does) copy data > > to userland-supplied buffer. > > > > NAK for that reason alone, and to be honest I had been too busy > > suppressing the gag reflex to read and comment any deeper. > > > > I really hate that approach, in case it's not clear from the above. > > To the degree that I don't trust myself to filter out the obscenities > > if I try to comment on it right now. > > > > The only blocking thing we can afford under namespace_sem is GFP_KERNEL > > allocation. > > Incidentally, attach_recursive_mnt() only gets you the root(s) of > attached tree(s); try mount --rbind and see how much you've missed. Okay. Both trivially fixable: - the dir_emit() can be taken out from under the mutex and the rb tree search repeated for every entry; possibly not as efficient, but I guess at this point that's irrelevant - addition of the mountfs entry moved to the right places Thanks, Miklos