From: Matthew Wilcox <willy@infradead.org>
To: aloktiagi <aloktiagi@gmail.com>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org,
David.Laight@aculab.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, keescook@chromium.org,
hch@infradead.org, Tycho Andersen <tycho@tycho.pizza>
Subject: Re: [RFC v3 3/3] file, epoll: Implement do_replace() and eventpoll_replace()
Date: Fri, 24 Mar 2023 05:24:26 +0000 [thread overview]
Message-ID: <ZB00Cvib+jyqCR5C@casper.infradead.org> (raw)
In-Reply-To: <20230324051526.963702-3-aloktiagi@gmail.com>
On Fri, Mar 24, 2023 at 05:15:26AM +0000, aloktiagi wrote:
> diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
> index 3337745d81bd..38904fce3840 100644
> --- a/include/linux/eventpoll.h
> +++ b/include/linux/eventpoll.h
> @@ -25,6 +25,8 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long t
> /* Used to release the epoll bits inside the "struct file" */
> void eventpoll_release_file(struct file *file);
>
> +void eventpoll_replace_file(struct file *toreplace, struct file *file);
> +
> /*
> * This is called from inside fs/file_table.c:__fput() to unlink files
> * from the eventpoll interface. We need to have this facility to cleanup
> @@ -53,6 +55,22 @@ static inline void eventpoll_release(struct file *file)
> eventpoll_release_file(file);
> }
>
> +
> +/*
> + * This is called from fs/file.c:do_replace() to replace a linked file in the
> + * epoll interface with a new file received from another process. This is useful
> + * in cases where a process is trying to install a new file for an existing one
> + * that is linked in the epoll interface
> + */
> +static inline void eventpoll_replace(struct file *toreplace, struct file *file)
> +{
> + /*
> + * toreplace is the file being replaced. Install the new file for the
> + * existing one that is linked in the epoll interface
> + */
> + eventpoll_replace_file(toreplace, file);
> +}
Why do we have both eventpoll_replace() and eventpoll_replace_file()?
They seem identical?
> diff --git a/include/linux/file.h b/include/linux/file.h
> index 39704eae83e2..80e56b2b44fb 100644
> --- a/include/linux/file.h
> +++ b/include/linux/file.h
> @@ -36,6 +36,7 @@ struct fd {
> struct file *file;
> unsigned int flags;
> };
> +
> #define FDPUT_FPUT 1
> #define FDPUT_POS_UNLOCK 2
>
You should drop this hunk of the patch.
next prev parent reply other threads:[~2023-03-24 5:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 5:15 [RFC v3 1/3] file: Introduce iterate_fd_locked aloktiagi
2023-03-24 5:15 ` [RFC v3 2/3] file: allow callers to free the old file descriptor after dup2 aloktiagi
2023-03-24 5:28 ` Matthew Wilcox
2023-03-24 5:58 ` Alok Tiagi
2023-03-24 5:15 ` [RFC v3 3/3] file, epoll: Implement do_replace() and eventpoll_replace() aloktiagi
2023-03-24 5:24 ` Matthew Wilcox [this message]
2023-03-24 5:56 ` Alok Tiagi
2023-03-24 5:20 ` [RFC v3 1/3] file: Introduce iterate_fd_locked Matthew Wilcox
2023-03-24 5:52 ` Alok Tiagi
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=ZB00Cvib+jyqCR5C@casper.infradead.org \
--to=willy@infradead.org \
--cc=David.Laight@aculab.com \
--cc=aloktiagi@gmail.com \
--cc=brauner@kernel.org \
--cc=hch@infradead.org \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tycho@tycho.pizza \
--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
all inboxes | Powered by JetHome®