From: Jens Axboe <axboe@kernel.dk>
To: Dylan Yudaken <dylany@fb.com>, viro@zeniv.linux.org.uk, bcrl@kvack.org
Cc: linux-fsdevel@vger.kernel.org, linux-aio@kvack.org,
linux-kernel@vger.kernel.org, Kernel-team@fb.com
Subject: Re: [PATCH] eventfd: guard wake_up in eventfd fs calls as well
Date: Wed, 17 Aug 2022 10:44:16 -0600 [thread overview]
Message-ID: <6d6df27f-a5c3-d6dd-ac1c-1d1c0fe53aaa@kernel.dk> (raw)
In-Reply-To: <20220816135959.1490641-1-dylany@fb.com>
On 8/16/22 07:59, Dylan Yudaken wrote:
> Guard wakeups that the user can trigger, and that may end up triggering a
> call back into eventfd_signal. This is in addition to the current approach
> that only guards in eventfd_signal.
>
> Rename in_eventfd_signal -> in_eventfd at the same time to reflect this.
>
> Without this there would be a deadlock in the following code using libaio:
>
> int main()
> {
> struct io_context *ctx = NULL;
> struct iocb iocb;
> struct iocb *iocbs[] = { &iocb };
> int evfd;
> uint64_t val = 1;
>
> evfd = eventfd(0, EFD_CLOEXEC);
> assert(!io_setup(2, &ctx));
> io_prep_poll(&iocb, evfd, POLLIN);
> io_set_eventfd(&iocb, evfd);
> assert(1 == io_submit(ctx, 1, iocbs));
> write(evfd, &val, 8);
> }
Reviewed-by: Jens Axboe <axboe@kernel.dk>
--
Jens Axboe
next prev parent reply other threads:[~2022-08-17 16:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 13:59 [PATCH] eventfd: guard wake_up in eventfd fs calls as well Dylan Yudaken
2022-08-17 16:44 ` Jens Axboe [this message]
2022-08-30 15:12 ` Jens Axboe
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=6d6df27f-a5c3-d6dd-ac1c-1d1c0fe53aaa@kernel.dk \
--to=axboe@kernel.dk \
--cc=Kernel-team@fb.com \
--cc=bcrl@kvack.org \
--cc=dylany@fb.com \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).