Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7383163rdb; Wed, 3 Jan 2024 14:15:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGkp1oDBXJ0Uj0ce/lWyWVLzgZF0t7ANy+m9gQV4Kq8YCcOHdarcBrzg7T9FWd4EOKsNVQ X-Received: by 2002:a05:6830:1482:b0:6db:b0f2:19dc with SMTP id s2-20020a056830148200b006dbb0f219dcmr15593197otq.57.1704320102254; Wed, 03 Jan 2024 14:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704320102; cv=none; d=google.com; s=arc-20160816; b=aubOoUq1yX1GA45xISZpBDdHbXpQsVfg+2DygLSw9c1d/rSfPwSDAIpuKt083MT68Y d98578UXwnsNzPRS9+4LUvaKH4p/Q3CQzObp10VIfOIRnG9arK8OYXqSYUAo3fZaBPX+ lc8NkITq4tHTAJoop57NIXkHbfoKrdnatqnyA8LBiktThXcXguyN74sabgc5ISj4NypI t+7f4Cgjw0QQ78SkH/RHuWywTeZTUTgV3htZ79ncZDueKqaL33rW4d+gMos1gyzQ7tOu 5FFgLqognZP0mQUWYIMzMkvYTVFMzz2uNpnXxC3gPPlo9gJyhZ8paSdZfGgJfSOJ4KW8 abOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=Mevc66h8/YxLoi9wAdpdKGyoq3lct+F8bAue6hHvt8U=; fh=VHtCGegtydHfdtjDhE6chAEayI+pSOB5wnQi9ahH2IY=; b=zox1wC86i8aEjoHW8Hdp/Iro1xv7MHrJT95cSQgKS9T11d72mNHFPd2fLKC/D1kiv3 DWt3pe7XWSEMR0bgfSUetaJ82tElhLxHC5NVf7bzvcqZlWTK4h4Lf/4EG0xvizV2JcnY vJK1PNgfEXdK5p6RvAm2nQgL1c8JnmwjHib66gL5T28QWbAyjUyKEK6RC52fkHWjJg5P xQ53PP9RTCtwlGk+E2YxNR5ERAKcIQm9mRvxn9ZIcD84yex6EPVeiBw229YIeyjEwblU 0tIPc6TtzM15TBccdMxivGBbhlhjcpwUUrb5zDPsWjdu04Of+5z2HRsiunbFEuYrZxc7 EJHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ryvZdaw2; spf=pass (google.com: domain of linux-kernel+bounces-16060-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16060-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fx4-20020a05622a4ac400b00427f29eea3dsi16509083qtb.327.2024.01.03.14.15.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 14:15:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16060-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ryvZdaw2; spf=pass (google.com: domain of linux-kernel+bounces-16060-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16060-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 077791C23444 for ; Wed, 3 Jan 2024 22:15:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26DDF1DA50; Wed, 3 Jan 2024 22:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="ryvZdaw2" X-Original-To: linux-kernel@vger.kernel.org Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DB1C1DDE0; Wed, 3 Jan 2024 22:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Mevc66h8/YxLoi9wAdpdKGyoq3lct+F8bAue6hHvt8U=; b=ryvZdaw25tkBx62MMMAokDj+sv Xu16nIxI4VKMfhO2Bz/pCYQ8wrIPdkYPbh9I61CDiT/jhEJVoTN97bO89Nnlu2HcvDkOJumBauzot WSwrN3XPMDPvjKlDqOZi38GVI9f8SGs5zDEilx0VX6Ji2he3ahgCeCcMAH6AmKYp8cGGDtfLc4zp6 wAqPLIXYIFTFq9XLGup06M6avGfp15hfLtr9xBf9/g6Hc0ytS18eTZvMCKQixJhmf2TLtLrVBJEHy UEnxTBNIs+4JSaOohoAfYnSTPetakC2dMvDCyuErGeRi5Tnub+yC66+8hsuBWZdJ4bX1F0vmeTV6B QFCVR4jg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rL9Vc-000owZ-0C; Wed, 03 Jan 2024 22:14:44 +0000 Date: Wed, 3 Jan 2024 22:14:44 +0000 From: Al Viro To: Linus Torvalds Cc: Steven Rostedt , LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Christian Brauner , linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH] eventfs: Stop using dcache_readdir() for getdents() Message-ID: <20240103221444.GM1674809@ZenIV> References: <20240103102553.17a19cea@gandalf.local.home> <20240103145306.51f8a4cd@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro On Wed, Jan 03, 2024 at 01:54:36PM -0800, Linus Torvalds wrote: > Again: UNTESTED, and meant as a "this is another way to avoid messing > with the dentry tree manually, and just using the VFS interfaces we > already have" That would break chown(), though. From conversation back in November: 17:50 #kernel: < viro> while we are at it, why not simply supply ->permission() and ->getattr() that would pick gid from superblock and shove them into ->i_gid? 17:50 #kernel: < viro> and called the default variants 17:50 #kernel: < viro> no need to scan the tree, etc. 17:51 #kernel: < viro> how many place in VFS or VM give a fuck about GID of inode? 17:53 #kernel: < viro> stat() and permission checks 17:56 #kernel: < viro> but that boils down to "well, generic getattr and permission use that field and on-disk filesystems use it to keep track of what value to put on disk" 17:56 #kernel: < viro> you can trivially override the defaults for ->permission() and ->getattr() 17:57 #kernel: < viro> and have them set the right ->i_gid whenever called 17:58 #kernel: < viro> what do you want to happen for chown() + remount? 17:58 #kernel: < viro> any group changes from the former lost on the latter? 18:00 #kernel: < viro> if you want the current semantics, slap generation counter in superblock (bumped on remount) 18:00 #kernel: < viro> sample it into inode on ->setattr() 18:01 #kernel: < viro> and have ->permission() and ->getattr() compare inode and superblock gen counts, picking ->i_gid from superblock if it's more recent there 18:02 #kernel: < viro> if you want the result of chown() to stick, have it stuff ~0U into inode's gen counter instead of sampling the superblock's counter there 18:17 #kernel: < viro> OK... so we need to filter SB_I_VERSION out of flags on mount/remount, lest the timestamp updates start playing silly buggers with it 18:18 #kernel: < viro> and use inode_..._iversion_raw() for access 18:19 #kernel: < viro> or use ->i_generation, perhaps... 18:20 #kernel: < viro> 32bit, but if somebody does 4G mount -o remount, they are deliberately asking for trouble 21:37 #kernel: < viro> hmm... 21:37 #kernel: < viro> ->d_revalidate() as well, probably 21:39 #kernel: < viro> rostedt: my apologies, looks like I had been too optimistic I have the beginnings of patch along those lines stuck in the local tree, but the problem had been that ->d_revalidate() is not always called on the way to some places where ->i_uid/->i_gid is accessed ;-/ I can resurrect the analysis, but that'll take a few hours.