From: Jens Axboe <axboe@kernel.dk>
To: Daniele Di Proietto <daniele.di.proietto@gmail.com>,
io-uring@vger.kernel.org
Cc: Keith Busch <kbusch@kernel.org>,
Pavel Begunkov <asml.silence@gmail.com>,
linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH v3 4/4] io_uring: Add IORING_OP_DUP
Date: Mon, 23 Mar 2026 08:23:09 -0600 [thread overview]
Message-ID: <4a3cf1f2-274a-4ceb-9980-4b379e81394a@kernel.dk> (raw)
In-Reply-To: <20260321232142.911280-5-daniele.di.proietto@gmail.com>
On 3/21/26 5:21 PM, Daniele Di Proietto wrote:
> + if (((id->flags & IORING_DUP_NEW_FIXED) == 0) ==
> + ((id->flags & IORING_DUP_OLD_FIXED) == 0) &&
> + id->old_fd == id->new_fd)
> + return -EINVAL;
I think !(id->flags BLA) == would be shorter and hence easier to read.
This is hard to read, at least for me.
> +static int io_dup_to_fd(struct io_kiocb *req, unsigned int issue_flags,
> + bool old_fixed, int old_fd, int new_fd, int o_flags)
> +{
> + bool non_block = issue_flags & IO_URING_F_NONBLOCK;
> + struct files_struct *files = current->files;
> + struct file *old_file, *to_close = NULL;
> + int err;
> +
> + if (new_fd >= rlimit(RLIMIT_NOFILE))
> + return -EBADF;
> +
> + if (old_fixed)
> + old_file = io_dup_get_old_file_fixed(req, issue_flags, old_fd);
> +
> + {
> + guard(spinlock)(&files->file_lock);
I did suggest a function, but if you're not doing that, at least use a
scoped_guard rather than have some randomly inserted scope here. That
looks like AI code..
--
Jens Axboe
prev parent reply other threads:[~2026-03-23 14:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 23:21 [PATCH v3 0/4] New IORING_OP_DUP Daniele Di Proietto
2026-03-21 23:21 ` [PATCH v3 1/4] io_uring: Extract io_file_get_fixed_node() helper Daniele Di Proietto
2026-03-21 23:21 ` [PATCH v3 2/4] fs: Export expand_files() Daniele Di Proietto
2026-03-21 23:21 ` [PATCH v3 3/4] fs: Export new helper do_replace_fd_locked() Daniele Di Proietto
2026-03-23 12:00 ` Christian Brauner
2026-03-23 14:20 ` Jens Axboe
2026-03-21 23:21 ` [PATCH v3 4/4] io_uring: Add IORING_OP_DUP Daniele Di Proietto
2026-03-23 14:23 ` Jens Axboe [this message]
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=4a3cf1f2-274a-4ceb-9980-4b379e81394a@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=brauner@kernel.org \
--cc=daniele.di.proietto@gmail.com \
--cc=io-uring@vger.kernel.org \
--cc=jack@suse.cz \
--cc=kbusch@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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