From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A4646072C42 for ; Mon, 2 Nov 2026 15:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZkdIoUzZ Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jJG1N1c7Wz3bnL; Tue, 03 Nov 2026 02:32:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1793633576; cv=none; b=RkDtDyzXKS5MfQF6c+SFrTeqmnwtOgH8Oi83ArzM4Y15YEV+wlLv1i/lc9sZQ3BJJSF7YQQLe2KNROIwZENgeHDFSNeQnQ4U1JZrdRCkBk3PCNOcgrPiGv6yN1b/zfEmTh/06a0nuC7cnRA5aPqbyv2ndCE0iD2V5PC/PI2nPLLNS2j/QuXdFNnQ7RJw+8YPC9Z//tBD/P92m0dO1xIjrBHtI/sbN7bOmnsQMOLpoB3LV7aOzESVhH80LS3V+V3bQcY0+UxQvHJQMnobTf3Dba6OM+4vOZ7r/bPFCnIoWJlk/k3lTvGtUGG71n9LTIcU7SmHrF2ee9maONprhdPa7Q== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1793633576; c=relaxed/relaxed; bh=xwE+gN56hE51AorwZpbrVa8dzdnGmSpFpcgiuf3dvqw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LhdDMEEYHSoZga/kCubuyV5eB94bq3EV0CCVC9WN8T5ZYcewOQVXQRnSIbQ1LnMuXcQjOPhV0B8ZONoUOc6Nfsu2qo4nFpEMuxUXwMmC+oxvvbPMjpWWHWegxHN+cy7IEWNh+aFsaOB/sEEPsxf3wg4s8r8yHo2GYy9Dhvuirmf7M9Libg36PZOwYc8CVwzKJHOexaGSvwyImlLQuEqQAzwzWpZ9yo4tz3gSfbTBEXD4rEjeoTNKRqFFLOGraon9Cd4RsA9ydS+HVfT5MToEshfz8mH422j2pzkE+ANHFEd/IDP4asuMuPOkB6oyHU4ShOt4TlFcthRxuBAh/M9fqw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZkdIoUzZ; dkim-atps=neutral; spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=brauner@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZkdIoUzZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=brauner@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jJG1M2Lfsz3blk for ; Tue, 03 Nov 2026 02:32:55 +1100 (AEDT) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 59FDE605D1; Mon, 2 Nov 2026 15:32:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5BD51F00A16; Mon, 2 Nov 2026 15:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793633573; bh=xwE+gN56hE51AorwZpbrVa8dzdnGmSpFpcgiuf3dvqw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ZkdIoUzZRdQstvJJGwaGXuz34UXdVd9KnN9ZJc3nP27AG3GLe8vMenko9Tiu+l4yV 4/eK0kdxB9N+Iz0Yx6dr+YotVggYI8nlCZEvmDr9lO/WoWjHo18zAakL9FX2BCmjDx mJmMK2I8BK4i3qt963tlhaBmXuV/d6nxajg5m4xkht+xWIGtqgCPx/5sAyRymy14bP 4KLL09VHA9etPNuG4Bi+X52PjSZJxfUN0TyZqVAjhyTJxpADAlMTaef79a51Inhh1f KQvYYLJ04QvmjznL9iSrSnxSYVcd8eF+n1EAEbkOWhWDHBKQ0TlFa4oEqY4+mpy2bp OjhbKNeE0RTjQ== From: Christian Brauner Date: Mon, 02 Nov 2026 16:07:20 +0100 Subject: [PATCH RFC 06/11] SUNRPC: let procfs own the seq_file of the cache content file X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , Precedence: list X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261102-work-procfs-net-v1-6-982104a4f592@kernel.org> References: <20261102-work-procfs-net-v1-0-982104a4f592@kernel.org> In-Reply-To: <20261102-work-procfs-net-v1-0-982104a4f592@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jann Horn , Josef Bacik , Chris Mason , Jeff Layton , NeilBrown , Eric Dumazet , Thomas Gleixner , Al Viro , Jonathan Corbet , Christoph Hellwig , Greg Kroah-Hartman , Joel Granados , Kees Cook , Jan Kara , Jan Kara , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai , linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" , Chuck Lever X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1589; i=brauner@kernel.org; h=from:subject:message-id; bh=8vuLt15HI84MkjiR5ofNiQbYBWJycXJMPW98KiaZ28g=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS9WG6cvyvvXN+5FNeT984x/JZU3WJc97VU21Z5x4ejN wVit9i4dJSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAEzEIo6R4b/ei60fuk86FUUz vt99O+xLZ+VMycIfR1z13il2v/5unsbwVz5pQbOt4GZXF4e/d+SV1t2v/7fDb/rx0gLLFQ95fd/ GcwAA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Declare the seq_operations and let procfs open and free the seq_file of /proc/net/rpc//content. ->proc_open() and ->proc_release() only take and drop the module reference and set up ->private now. The rpc_pipefs file is unchanged. Reading the procfs file then no longer holds up its removal when the network namespace goes away. Signed-off-by: Christian Brauner (Amutable) --- net/sunrpc/cache.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 1ceaea7e01b9..007521e8a57f 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1606,24 +1606,28 @@ static const struct proc_ops cache_channel_proc_ops = { .proc_release = cache_release_procfs, }; +/* procfs opens the seq_file */ static int content_open_procfs(struct inode *inode, struct file *filp) { struct cache_detail *cd = pde_data(inode); - return content_open(inode, filp, cd); + if (!cd || !try_module_get(cd->owner)) + return -EACCES; + ((struct seq_file *)filp->private_data)->private = cd; + return 0; } static int content_release_procfs(struct inode *inode, struct file *filp) { struct cache_detail *cd = pde_data(inode); - return content_release(inode, filp, cd); + module_put(cd->owner); + return 0; } static const struct proc_ops content_proc_ops = { + .proc_seq_ops = &cache_content_op, .proc_open = content_open_procfs, - .proc_read = seq_read, - .proc_lseek = seq_lseek, .proc_release = content_release_procfs, }; -- 2.53.0