🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15685

Re: [PATCH RFC 33/41] fs: add file_is_pseudo()

#15685
From: Alexander Mikhalitsyn
Date: Fri, 13 Nov 2026 10:15
53 lines
13728 bytes
On Tue, 2026-11-10 at 10:14 +0100, Christian Brauner wrote:
> Add a helper to check whether a file is a regular file on a pseudo
> filesystem. Only regular files count. Device nodes on pseudo
> filesystems
> such as devpts, binderfs or the block devices on bdevfs are what they
> are.
> 
> Look at the inode that actually provides the data via d_real_inode().
> overlayfs accepts sysfs, cgroup2, debugfs, tracefs, configfs and
> securityfs as lower layers and reads of such an overlayfs file are
> served by the file on the pseudo filesystem. Checking the overlayfs
> inode would miss that.
> 
> No functional changes.
> 
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>

Reviewed-by: Alexander Mikhalitsyn <alex@amutable.com>

> ---
>  include/linux/fs.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 99caef43ff3c..407ffb6342ec 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2553,6 +2553,18 @@ static inline const struct inode
> *file_user_inode(const struct file *f)
>  	return file_inode(f);
>  }
>  
> +/*
> + * Regular files on pseudo filesystems are kernel interfaces and
> must not be
> + * used as storage. Look through stacking filesystems at the inode
> that
> + * provides the data.
> + */
> +static inline bool file_is_pseudo(const struct file *file)
> +{
> +	const struct inode *inode = d_real_inode(file-
> >f_path.dentry);
> +
> +	return S_ISREG(inode->i_mode) && (inode->i_sb->s_iflags &
> SB_I_PSEUDO);
> +}
> +
>  static inline struct file *file_clone_open(struct file *file)
>  {
>  	return dentry_open(&file->f_path, file->f_flags, file-
> >f_cred);
Technical Details
Message-ID: <e2edfa06d185acd86b46945622b6eb6dff97b307.camel@amutable.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362549-linux-kernel-netdev=dewy.ru
References: <20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org> <20261110-work-loop-pseudo-v1-33-4c998976c6c7@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362549-linux-kernel-netdev=dewy.ru
From: alex@amutable.com (Alexander Mikhalitsyn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH RFC 33/41] fs: add file_is_pseudo()
Date: Fri, 13 Nov 2026 11:15:14 +0100
Organization: Usenet Network
Message-ID: <e2edfa06d185acd86b46945622b6eb6dff97b307.camel@amutable.com>
References: <20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org>
	 <20261110-work-loop-pseudo-v1-33-4c998976c6c7@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1326425"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VwHbiJodtet5EgArDRdUYPX2AVw= sha256:D3J66aGZSGDdS23gF46gzdbz7erUl7Tj1in0bTn6g5A=
	sha1:CMQ/aOMK1qSBAu4nCaNrv2DABiA= sha256:h3Q2c9E77VbKR/0CMqbJPAWGycef9L9aA9Bt+8FTBMo=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 06DA7114500; Fri, 13 Nov 2026 14:28:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=amutable-com.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Hd18tzqPtc2n;
	Fri, 13 Nov 2026 14:28:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-362549-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=amutable.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 303D8114413; Fri, 13 Nov 2026 14:28:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id F33F418A8FF; Fri, 13 Nov 2026 10:16:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794564919;
	b=w/gzJEcdWS5kukWG1Et/qXC3HSpKWOgxlKiZVHNkt/Airlafqy7kUZ0bchQsoIMeBQRd
	 WPA/ChbcmVTS1CJvT8RPJBxRkvTcqu4hxd7bjabd4Qvw1mIH5Xja+evqIrTx39BBetsNg
	 D9W6pnDmZJv3nhDL+D6FDTQ0grAI4bQg8qu7rCLQOqz9sy3/LN73HkI1Qr0y3vL/E2Czr
	 fvjlshBEupObK3RPa2yMgYI3ZY+tGZjUMZkK/dCgCnH9wGD2bziFgy6rehr7kmePIvrBN
	 gMtH5rQoZ145xD68aZptIKy5sCagQQmAizsqnxWHMPlfzWG7JSFEFRugbLXS7IDC4RA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794564919;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Message-ID:Subject:From:To:Cc:Date:
	 In-Reply-To:References:Content-Type:Content-Transfer-Encoding:
	 User-Agent:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version;
	bh=QtOsdPCKGJ1fBhMqXd/zLQfd50NEx4L7veNiE/G2OUE=;
	b=fVsy0ofS6ERMqWQKdSHPrpY0oDw17fYtydOSkgC8VK5hVzreNMCb80ICg5Mprx+IjVUZ
	 yVSG1xFTzqzh9q6Duq1Ir6HTJtBnI4dXgDNtLJ5g/jZ1k9FHgMwtl/NlxkwSXZUgbd7jP
	 K+oMqc5QK0jfdxSngAknzriYeQpC/KfiNn00hI18gZfnSvyD2Uxm0I9MwjaZq+YTajnM0
	 3QjQ5GqrFf+6HlHdCB6n/Fmxo/khuGJzoGUaBsPSgcmapGDqBMpa+Qc7LValnOGgqpcQU
	 sxODcWaOdUepp/WV1JQYGRSxIT13wrxyfy1NH0wBI1JoNuM+vqUAxWrE8PxAbzQyrHg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=XokUN4uh;
	dmarc=none header.from=amutable.com;
	spf=pass smtp.mailfrom=amutable.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D663060A261A;
	Fri, 13 Nov 2026 10:15:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=XokUN4uh
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.42
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794564919;
	b=eb8cfEief/t0eZCi+2T4p5j7Xbx7lYUaIOP/u/7qcCpIBIWZsNNfL9rXGPVtbbqYriHD
	 Cr2yhPmAeT09N2ApsUoAVQ7lx+oadKWkYPcPTc5+VsriGfFZyBgh/0aOyX/mI1zGmCeES
	 KL6J6b9s6Uzl+OGcgFJchbSkYGDWK/iHoD8jkepfLkWIm6maRD1CJDFqgR5iXyUD83TAr
	 m7KY1YK1vWMYmabqdUNdQP2JBAdgAsnCn9LD2UqzX01RxW93XYWkJ7f2urFMlvVPaJZdN
	 N7Kse9plAhVMthnuBPQbug+Dx8VgOCOj60SejohBxVv/VAwkTaH1d0sVo3dkIRv22qw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794564919;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
	 Content-Type:Content-Transfer-Encoding:User-Agent:MIME-Version;
	bh=QtOsdPCKGJ1fBhMqXd/zLQfd50NEx4L7veNiE/G2OUE=;
	b=h6ORjgA2EMcbhxUAUpkiRAWzP3B08XaKYvCkXawe+qvHrjwXaxVvRYJgXCd9kbLuDJMJ
	 5z0LNZ/jXf5qZ2zy6j4j4yTedTVKtXCKjrY0SLCU7tAb3pG062jefFBT0jPtZ7qoFA14s
	 bYuOsuCYPQBEDqDZxtafmjEF6WxnVfn5KCcI1IJxKVdXJp2UZ9sV2yTO+K3MbBu1yQyOx
	 aMhUxXtuuVOBQddZS8pOmBnWC9DjikAc2McI+yxjedh67OmFCg2nBYbGC9MCQZ9djkM13
	 nSgiLFq4cRBuh0Ud+u2Y19jGaTmp/7FBjGivU6cXziOzPB294czxopgmvcte6fRlOOQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=amutable.com;
	spf=pass smtp.mailfrom=amutable.com;
	dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=XokUN4uh;
	arc=none smtp.remote-ip=209.85.128.42
X-Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0CE8606A8AD
	for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 10:15:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A0CE8606A8AD
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com
X-Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4a5087a5348so5469235e9.0
        for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 02:15:18 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=amutable-com.20260707.gappssmtp.com; s=20260707; t=1794564917; x=1795169717; darn=vger.kernel.org;
        h=mime-version:user-agent:content-transfer-encoding:content-type
         :references:in-reply-to:date:cc:to:from:subject:message-id:from:to
         :cc:subject:date:message-id:reply-to:content-type;
        bh=QtOsdPCKGJ1fBhMqXd/zLQfd50NEx4L7veNiE/G2OUE=;
        b=XokUN4uhZ5cnIDNPS9kLjfaPp8ZSmyDY7nHz3ffF9uftFGQzzc0NaUd0CPxl6tmm/G
         EB2bqVZrrrQULKzHfxmMlarOF7+NP4G1EuGLp1x7hwkFzcf5DKQIlYH5+zTWTg0qLXK8
         Q27+pu7matN83z4kFimCCYFY9EtcVBpSYh+f+WbPWczzC82gi2dU1+IxENiNgIvD4ssI
         1POQJndyP8zOY9I/drEtHc8Rir/wcokVwFCL8xkdsULqRcKqvw/m2pftg5e6OYSufYMA
         FPm06vn59Z5lYx4UA2FpKr0UjB0BBdejlJLIE+RKFWt9/d0/clXrD3SuYpmwDbHdW+74
         JQJg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794564917; x=1795169717;
        h=mime-version:user-agent:content-transfer-encoding:content-type
         :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=QtOsdPCKGJ1fBhMqXd/zLQfd50NEx4L7veNiE/G2OUE=;
        b=RlLnENAMke+nKIPFFNobjZtuKBN9XpAwLpych4WytnJwpFN/Z74EkDw6/Auc10v4sG
         4gJ8Op+MvZ1bMx7r2Q2csIL37a838iZ/UKiMvpbKtFzKn0b/9zqzOA/L96TQP22VK2y5
         jS0ah79/wXUQg5U6qmfNNxkqzH4b5VuvxnYzU43FFtJ+vbhxJJG2um9PHig9JmNv/a2w
         aqxBo435Vn0N3FjEFBX6p+2ugUaHy4FUAsG1S25mTPWX78bWmlJ6B450x5cVQcPQFFJE
         Svuog/kLbHNFDAF5oDiXasRJSbW0UH/UbNilwN1g8dYUSkF6fG/VNZMf8qb8K9yVDTjG
         OGlw==
X-Forwarded-Encrypted: i=1; AL+hErGesnEIGFADUi/eH7nAklz0onMjHIggTi1Zsad4X/kIg0fB7CM1EsmejGKsY62CBYLHSBA4ysc=@vger.kernel.org
X-Gm-Message-State: APuU4Z/L8fErc2nz2EKNcQjXvnhU8yj/r0zTHVpNDxEzBRriJbiIvIcT
	uHUA0vLyuzAYVQqS6W0bnGiKxfvSgknanD44JccPOAu+k0wtSodQGnALwmfevWkIq1dp
X-Gm-Gg: AYBFou1O55+qot2EUVYI6/dVjvDofYexyCho2NW4V2BEAn5qxSsU/Bf5RetrwztxNak
	zP0btsDbXTFX2DVkDghNfYIX2q84Q6jH3zgRP8CRNZiWKPpGLghLHzmP6qVL3Wqn3dAwpA05KnC
	R/8i4PrfmQ2A1AqBKgF2PXXagO80rQ9BfakRrcj61/YWar4bm/reaF8BVwiDCcB66OxVAQykbhM
	Eu+kNzly+/DSlm6bK/K760CgfuW+xXSWS4IQjY46S5Kht6K1TziEXVkCQ6NRy3Lq1vK03chMhT5
	zuPN7pUSgyD7a81xtRVOgNr50MvCK9jLMZ79UKlJCY/IcAUCw/v4osr2NS7C8z7avhUs2xLm/M5
	ZqOpqWjIHKtb/12RfZ0Sl1RwJtvexzyRqadBYCSdoDHiw6PoW9HueQKxnPPBMFLbXJGetaG0kR0
	5nDoU57PzY1C/mWQQwREMHtchBUD7Bk4Uqvzag5Tq292k3mThOSlYQhRbnupMHDV8RMyGk0cMZm
	ewXVjsrTnCa672ZvGQydlsovhYF9lxqU2LFBYxFp5hjq+kQgtXl8PFu3sXkSd7yoMnd5hiyIipk
	1SFgeoCXKi5sCBT0MaMC7VuUfFf4h+Ybiff3LiGBctDxlZnXv/ug6frSTXtg2Gg=
X-Received: by 2002:a05:600c:4f84:b0:4a7:7f3f:6f8e with SMTP id 5b1f17b1804b1-4bb5599ade1mr43492835e9.0.1794564916955;
        Fri, 13 Nov 2026 02:15:16 -0800 (PST)
X-Received: from [10.0.0.233] (tmo-086-54.customers.d1-online.com. [80.187.86.54])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb56680ea9sm31982365e9.0.2026.11.13.02.15.14
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 13 Nov 2026 02:15:16 -0800 (PST)
X-Cc: Jann Horn <jannh@google.com>, Chris Mason <mason@kernel.org>, Josef
 Bacik	 <josef@toxicpanda.com>, Christoph Hellwig <hch@lst.de>, 
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, 
	linux-nvme@lists.infradead.org, Alexander Viro <viro@zeniv.linux.org.uk>,
 Jan Kara <jack@suse.cz>, linux-scsi@vger.kernel.org,
 target-devel@vger.kernel.org, 	driver-core@lists.linux.dev,
 linux-mm@kvack.org, bpf@vger.kernel.org, 
	linux-security-module@vger.kernel.org, selinux@vger.kernel.org, 
	apparmor@lists.ubuntu.com, linux-nfs@vger.kernel.org,
 netdev@vger.kernel.org, 	fuse-devel@lists.linux.dev,
 linux-efi@vger.kernel.org, 	xen-devel@lists.xenproject.org,
 ocfs2-devel@lists.linux.dev, 	linux-s390@vger.kernel.org,
 linuxppc-dev@lists.ozlabs.org, 	linux-usb@vger.kernel.org, Amir Goldstein
 <amir73il@gmail.com>, 	linux-erofs@lists.ozlabs.org,
 linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261110-work-loop-pseudo-v1-33-4c998976c6c7@kernel.org>
X-User-Agent: Evolution 3.56.2-0+deb13u1 
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list