linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
@ 2021-09-13 11:19 Xie Yongji
  2021-09-14 12:46 ` Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xie Yongji @ 2021-09-13 11:19 UTC (permalink / raw)
  To: bcrl, viro, tglx, axboe; +Cc: linux-aio, linux-fsdevel, linux-kernel

We should defer eventfd_signal() to the workqueue when
eventfd_signal_allowed() return false rather than return
true.

Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
 fs/aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 51b08ab01dff..8822e3ed4566 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
 		list_del(&iocb->ki_list);
 		iocb->ki_res.res = mangle_poll(mask);
 		req->done = true;
-		if (iocb->ki_eventfd && eventfd_signal_allowed()) {
+		if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
 			iocb = NULL;
 			INIT_WORK(&req->work, aio_poll_put_work);
 			schedule_work(&req->work);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-09-13 11:19 [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed() Xie Yongji
@ 2021-09-14 12:46 ` Thomas Gleixner
  2021-11-14  7:15 ` Yongji Xie
  2021-12-07 23:33 ` Eric Biggers
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2021-09-14 12:46 UTC (permalink / raw)
  To: Xie Yongji, bcrl, viro, axboe; +Cc: linux-aio, linux-fsdevel, linux-kernel

On Mon, Sep 13 2021 at 19:19, Xie Yongji wrote:
> We should defer eventfd_signal() to the workqueue when
> eventfd_signal_allowed() return false rather than return
> true.
>
> Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
>  fs/aio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 51b08ab01dff..8822e3ed4566 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
>  		list_del(&iocb->ki_list);
>  		iocb->ki_res.res = mangle_poll(mask);
>  		req->done = true;
> -		if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> +		if (iocb->ki_eventfd && !eventfd_signal_allowed()) {

Thanks for catching that!

>  			iocb = NULL;
>  			INIT_WORK(&req->work, aio_poll_put_work);
>  			schedule_work(&req->work);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-09-13 11:19 [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed() Xie Yongji
  2021-09-14 12:46 ` Thomas Gleixner
@ 2021-11-14  7:15 ` Yongji Xie
  2021-12-07 11:38   ` Yongji Xie
  2021-12-07 23:33 ` Eric Biggers
  2 siblings, 1 reply; 7+ messages in thread
From: Yongji Xie @ 2021-11-14  7:15 UTC (permalink / raw)
  To: bcrl, Al Viro, Thomas Gleixner, Jens Axboe
  Cc: linux-aio, linux-fsdevel, linux-kernel

Ping

On Mon, Sep 13, 2021 at 7:20 PM Xie Yongji <xieyongji@bytedance.com> wrote:
>
> We should defer eventfd_signal() to the workqueue when
> eventfd_signal_allowed() return false rather than return
> true.
>
> Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
>  fs/aio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 51b08ab01dff..8822e3ed4566 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
>                 list_del(&iocb->ki_list);
>                 iocb->ki_res.res = mangle_poll(mask);
>                 req->done = true;
> -               if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> +               if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
>                         iocb = NULL;
>                         INIT_WORK(&req->work, aio_poll_put_work);
>                         schedule_work(&req->work);
> --
> 2.11.0
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-11-14  7:15 ` Yongji Xie
@ 2021-12-07 11:38   ` Yongji Xie
  0 siblings, 0 replies; 7+ messages in thread
From: Yongji Xie @ 2021-12-07 11:38 UTC (permalink / raw)
  To: bcrl, Al Viro, Thomas Gleixner, Jens Axboe
  Cc: linux-aio, linux-fsdevel, linux-kernel

Ping again.

On Sun, Nov 14, 2021 at 3:15 PM Yongji Xie <xieyongji@bytedance.com> wrote:
>
> Ping
>
> On Mon, Sep 13, 2021 at 7:20 PM Xie Yongji <xieyongji@bytedance.com> wrote:
> >
> > We should defer eventfd_signal() to the workqueue when
> > eventfd_signal_allowed() return false rather than return
> > true.
> >
> > Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> > Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> > ---
> >  fs/aio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/aio.c b/fs/aio.c
> > index 51b08ab01dff..8822e3ed4566 100644
> > --- a/fs/aio.c
> > +++ b/fs/aio.c
> > @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
> >                 list_del(&iocb->ki_list);
> >                 iocb->ki_res.res = mangle_poll(mask);
> >                 req->done = true;
> > -               if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> > +               if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
> >                         iocb = NULL;
> >                         INIT_WORK(&req->work, aio_poll_put_work);
> >                         schedule_work(&req->work);
> > --
> > 2.11.0
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-09-13 11:19 [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed() Xie Yongji
  2021-09-14 12:46 ` Thomas Gleixner
  2021-11-14  7:15 ` Yongji Xie
@ 2021-12-07 23:33 ` Eric Biggers
  2021-12-10 18:53   ` Eric Biggers
  2 siblings, 1 reply; 7+ messages in thread
From: Eric Biggers @ 2021-12-07 23:33 UTC (permalink / raw)
  To: Xie Yongji
  Cc: bcrl, viro, tglx, axboe, linux-aio, linux-fsdevel, linux-kernel

On Mon, Sep 13, 2021 at 07:19:28PM +0800, Xie Yongji wrote:
> We should defer eventfd_signal() to the workqueue when
> eventfd_signal_allowed() return false rather than return
> true.
> 
> Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
>  fs/aio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 51b08ab01dff..8822e3ed4566 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
>  		list_del(&iocb->ki_list);
>  		iocb->ki_res.res = mangle_poll(mask);
>  		req->done = true;
> -		if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> +		if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
>  			iocb = NULL;
>  			INIT_WORK(&req->work, aio_poll_put_work);
>  			schedule_work(&req->work);
> -- 
> 2.11.0
> 

Since I was just working with this file...:

Reviewed-by: Eric Biggers <ebiggers@google.com>

I don't know who is taking aio fixes these days, but whoever does so probably
should take this one at the same time as mine
(https://lore.kernel.org/linux-fsdevel/20211207095726.169766-1-ebiggers@kernel.org).

- Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-12-07 23:33 ` Eric Biggers
@ 2021-12-10 18:53   ` Eric Biggers
  2021-12-12  8:07     ` Yongji Xie
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Biggers @ 2021-12-10 18:53 UTC (permalink / raw)
  To: Xie Yongji
  Cc: bcrl, viro, tglx, axboe, linux-aio, linux-fsdevel, linux-kernel

On Tue, Dec 07, 2021 at 03:33:47PM -0800, Eric Biggers wrote:
> On Mon, Sep 13, 2021 at 07:19:28PM +0800, Xie Yongji wrote:
> > We should defer eventfd_signal() to the workqueue when
> > eventfd_signal_allowed() return false rather than return
> > true.
> > 
> > Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> > Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> > ---
> >  fs/aio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/aio.c b/fs/aio.c
> > index 51b08ab01dff..8822e3ed4566 100644
> > --- a/fs/aio.c
> > +++ b/fs/aio.c
> > @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
> >  		list_del(&iocb->ki_list);
> >  		iocb->ki_res.res = mangle_poll(mask);
> >  		req->done = true;
> > -		if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> > +		if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
> >  			iocb = NULL;
> >  			INIT_WORK(&req->work, aio_poll_put_work);
> >  			schedule_work(&req->work);
> > -- 
> > 2.11.0
> > 
> 
> Since I was just working with this file...:
> 
> Reviewed-by: Eric Biggers <ebiggers@google.com>
> 
> I don't know who is taking aio fixes these days, but whoever does so probably
> should take this one at the same time as mine
> (https://lore.kernel.org/linux-fsdevel/20211207095726.169766-1-ebiggers@kernel.org).

Apparently no one is, so I've included this patch in the pull request I've sent
(https://lore.kernel.org/r/YbOdV8CPbyPAF234@sol.localdomain).

- Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed()
  2021-12-10 18:53   ` Eric Biggers
@ 2021-12-12  8:07     ` Yongji Xie
  0 siblings, 0 replies; 7+ messages in thread
From: Yongji Xie @ 2021-12-12  8:07 UTC (permalink / raw)
  To: Eric Biggers
  Cc: bcrl, Al Viro, Thomas Gleixner, Jens Axboe, linux-aio,
	linux-fsdevel, linux-kernel

On Sat, Dec 11, 2021 at 2:53 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Tue, Dec 07, 2021 at 03:33:47PM -0800, Eric Biggers wrote:
> > On Mon, Sep 13, 2021 at 07:19:28PM +0800, Xie Yongji wrote:
> > > We should defer eventfd_signal() to the workqueue when
> > > eventfd_signal_allowed() return false rather than return
> > > true.
> > >
> > > Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit")
> > > Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> > > ---
> > >  fs/aio.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/fs/aio.c b/fs/aio.c
> > > index 51b08ab01dff..8822e3ed4566 100644
> > > --- a/fs/aio.c
> > > +++ b/fs/aio.c
> > > @@ -1695,7 +1695,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
> > >             list_del(&iocb->ki_list);
> > >             iocb->ki_res.res = mangle_poll(mask);
> > >             req->done = true;
> > > -           if (iocb->ki_eventfd && eventfd_signal_allowed()) {
> > > +           if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
> > >                     iocb = NULL;
> > >                     INIT_WORK(&req->work, aio_poll_put_work);
> > >                     schedule_work(&req->work);
> > > --
> > > 2.11.0
> > >
> >
> > Since I was just working with this file...:
> >
> > Reviewed-by: Eric Biggers <ebiggers@google.com>
> >
> > I don't know who is taking aio fixes these days, but whoever does so probably
> > should take this one at the same time as mine
> > (https://lore.kernel.org/linux-fsdevel/20211207095726.169766-1-ebiggers@kernel.org).
>
> Apparently no one is, so I've included this patch in the pull request I've sent
> (https://lore.kernel.org/r/YbOdV8CPbyPAF234@sol.localdomain).
>

Thank you!

Thanks,
Yongji

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-12  8:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 11:19 [PATCH] aio: Fix incorrect usage of eventfd_signal_allowed() Xie Yongji
2021-09-14 12:46 ` Thomas Gleixner
2021-11-14  7:15 ` Yongji Xie
2021-12-07 11:38   ` Yongji Xie
2021-12-07 23:33 ` Eric Biggers
2021-12-10 18:53   ` Eric Biggers
2021-12-12  8:07     ` Yongji Xie

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).