diff mbox series

aio: Fix incorrect usage of eventfd_signal_allowed()

Message ID 20210913111928.98-1-xieyongji@bytedance.com (mailing list archive)
State New, archived
Headers show
Series aio: Fix incorrect usage of eventfd_signal_allowed() | expand

Commit Message

Yongji Xie Sept. 13, 2021, 11:19 a.m. UTC
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(-)

Comments

Thomas Gleixner Sept. 14, 2021, 12:46 p.m. UTC | #1
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);
Yongji Xie Nov. 14, 2021, 7:15 a.m. UTC | #2
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
>
Yongji Xie Dec. 7, 2021, 11:38 a.m. UTC | #3
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
> >
Eric Biggers Dec. 7, 2021, 11:33 p.m. UTC | #4
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
Eric Biggers Dec. 10, 2021, 6:53 p.m. UTC | #5
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
Yongji Xie Dec. 12, 2021, 8:07 a.m. UTC | #6
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
diff mbox series

Patch

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