Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp843308pxf; Thu, 8 Apr 2021 14:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhNRUJ1Owe2anspr5s69eVojmT9dvHxhA4tn4OLhop+1rBQvZLP14FZEjCMVKTg3GszUSg X-Received: by 2002:a63:2c8a:: with SMTP id s132mr9806786pgs.165.1617915969389; Thu, 08 Apr 2021 14:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617915969; cv=none; d=google.com; s=arc-20160816; b=I7bZeqSf/Xa8b7r8iIkdWXF9F2P6Lr2WD+aSi5i20Yt9y/03WL8Q6Hj3WyATf9fMzF D7k4S21wM98FyfFqwxRDGkdm3bdMPkE2QMxCZVm/Su1cc55jgcHKntoWiKUs6jaHrs9E 8ZfK3oS8gvWjeegJEG+ip70MAbLyqajTCCLCKmp9TE+qEkWZk4xLq7cq6gxlNqfzWbEl PBm0X9VEBXwUxRvyzlAKGiJ1amc5NJpH3A65NrJUmDrFwmuE+ziKK992oUARRkMCN7P1 RjLiAvAx8tH7SAWtKlVrTJNhk2SxdhdnEtr68UD3SJmjTHpkzMk0e/8KMBCEhSyQvhVI tX/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=F9suMrBtE90ferwq2ECfl1KYuhEbkG3Bi9rmqjaVsIY=; b=ZD9ReGUTihP2PtmdFUkkuSBTh4SCT9bVrAJiefEtwnJYqTSSRGynOjc0warcWMnSv4 V9fPnvSseZiFHjahGvqVIGj76IHJ7GwwLPVnvb4opCEUxPbKGCPidQtkPJkBP+9JuTUN J+uv5U8v9LnDQ0oj/NA50trP5S/1IJaJCAgyua/qVLl39eLRimbiblXa2K+PxTNuny1Q 1OrIPAbNYvKyjsgXr7guBh2OeCEWcb3iH5aIWwnzVgzDC0+le1DMje59tvG94Xw78VKR EJIFL2sxb2uD7V1xiJgZTLvfPvhvHOf0c8AGrfSV1H5SfOCytO+7D5ayppvrxhNnCnCL ASQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si431690pgd.42.2021.04.08.14.05.56; Thu, 08 Apr 2021 14:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232425AbhDHVEs (ORCPT + 99 others); Thu, 8 Apr 2021 17:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232091AbhDHVEp (ORCPT ); Thu, 8 Apr 2021 17:04:45 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8E9C061760; Thu, 8 Apr 2021 14:04:32 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lUbpG-003ny6-VI; Thu, 08 Apr 2021 21:04:31 +0000 Date: Thu, 8 Apr 2021 21:04:30 +0000 From: Al Viro To: Daniel Xu Cc: bpf@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, jolsa@kernel.org, hannes@cmpxchg.org, yhs@fb.com Subject: Re: [RFC bpf-next 1/1] bpf: Introduce iter_pagecache Message-ID: References: <22bededbd502e0df45326a54b3056941de65a101.1617831474.git.dxu@dxuuu.xyz> <20210408204935.4itnxm4ekdv7zlrw@dlxu-fedora-R90QNFJV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408204935.4itnxm4ekdv7zlrw@dlxu-fedora-R90QNFJV> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 08, 2021 at 01:49:35PM -0700, Daniel Xu wrote: > Ah right, sorry. Nobody will clean up the super_block. > > > IOW, NAK. The objects you are playing with have non-trivial lifecycle > > and poking into the guts of data structures without bothering to > > understand it is not a good idea. > > > > Rule of the thumb: if your code ends up using fields that are otherwise > > handled by a small part of codebase, the odds are that you need to be > > bloody careful. In particular, ->ns_lock has 3 users - all in > > fs/namespace.c. ->list/->mnt_list: all users in fs/namespace.c and > > fs/pnode.c. ->s_active: majority in fs/super.c, with several outliers > > in filesystems and safety of those is not trivial. > > > > Any time you see that kind of pattern, you are risking to reprise > > a scene from The Modern Times - the one with Charlie taking a trip > > through the guts of machinery. > > I'll take a closer look at the lifetime semantics. > > Hopefully the overall goal of the patch is ok. Happy to iterate on the > implementation details until it's correct. That depends. Note that bumping ->s_active means that umount of that sucker will *NOT* shut it down - that would happen only on the thread doing the final deactivation. What's more, having e.g. a USB stick mounted, doing umount(1), having it complete successfully, pulling the damn thing out and getting writes lost would make for a nasty surprise for users. With your approach it seems to be inevitable. Holding namespace_sem through the entire thing would prevent that, but's it's a non-starter for other reasons (starting with "it's a system-wide lock, so that'd be highly antisocial"). Are there any limits on what could be done to the pages, anyway? Because if it's "anything user wanted to do", it's *really* not feasible.