From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
linuxppc-dev@lists.ozlabs.org, linux-gpio@vger.kernel.org,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-media@vger.kernel.org,
wine-devel@list.winehq.org, linux-xfs@vger.kernel.org,
io-uring@vger.kernel.org, bpf@vger.kernel.org,
linux-mm@kvack.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH 0/4] file: simplify and harden cleanup handling
Date: Thu, 17 Sep 2026 11:09:41 +0200 [thread overview]
Message-ID: <20260917-work-file-fd_prepare-v1-0-b87534ca49f3@kernel.org> (raw)
The cleanup guards rely on unnecessary infrastructure and make the code
more complicated to follow than it needs to be. Clean it up. Also shrink
the struct a bit and get rid of the unnecessary error variable. We can
just make this more ergonomic by using fdf->fd directly. Also expose the
struct itself as const and hide the actual underlying local variable
behind a UNIQUE_ID() named variable so we avoid risking shadow variables
and polluting callsites. Code generation wise the outcome is exactly the
same but simpler.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
Christian Brauner (4):
file: simplify FD_PREPARE()
file: declare the FD_PREPARE() variable with __cleanup() directly
cleanup: remove CLASS_INIT()
file: make struct fd_prepare const and kill its err field
arch/powerpc/platforms/cell/spufs/inode.c | 12 +--
drivers/gpio/gpiolib-cdev.c | 18 ++---
drivers/gpu/drm/msm/msm_perfcntr.c | 4 +-
drivers/media/mc/mc-request.c | 8 +-
drivers/misc/ntsync.c | 6 +-
fs/eventfd.c | 4 +-
fs/eventpoll.c | 6 +-
fs/file.c | 8 +-
fs/namespace.c | 12 +--
fs/nsfs.c | 4 +-
fs/xfs/xfs_handle.c | 6 +-
include/linux/cleanup.h | 7 --
include/linux/file.h | 130 +++++++++++-------------------
io_uring/mock_file.c | 8 +-
kernel/bpf/bpf_iter.c | 6 +-
kernel/bpf/token.c | 6 +-
mm/userfaultfd.c | 6 +-
net/core/scm.c | 8 +-
net/handshake/netlink.c | 8 +-
net/kcm/kcmsock.c | 6 +-
20 files changed, 117 insertions(+), 156 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260917-work-file-fd_prepare-ea5966d68a95
next reply other threads:[~2026-09-17 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 9:09 Christian Brauner [this message]
2026-09-17 9:09 ` [PATCH 1/4] file: simplify FD_PREPARE() Christian Brauner
2026-09-17 9:09 ` [PATCH 2/4] file: declare the FD_PREPARE() variable with __cleanup() directly Christian Brauner
2026-09-17 12:22 ` David Laight
2026-09-17 9:09 ` [PATCH 3/4] cleanup: remove CLASS_INIT() Christian Brauner
2026-09-17 9:09 ` [PATCH 4/4] file: make struct fd_prepare const and kill its err field Christian Brauner
2026-09-17 12:29 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917-work-file-fd_prepare-v1-0-b87534ca49f3@kernel.org \
--to=brauner@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=io-uring@vger.kernel.org \
--cc=jack@suse.cz \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wine-devel@list.winehq.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®