On Wed, Mar 21, 2018 at 08:32:30AM +0100, Christoph Hellwig wrote:
> The upcoming aio poll support would like to be able to complete the
> iocb inline from the cancellation context, but that would cause
> a lock order reversal.  Add support for optionally moving the cancelation
> outside the context lock to avoid this reversal.
> 
> Signed-off-by: Christoph Hellwig <h...@lst.de>
> Acked-by: Jeff Moyer <jmo...@redhat.com>
> ---
>  fs/aio.c | 49 ++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 38 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 0b6394b4e528..9d7d6e4cde87 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -170,6 +170,10 @@ struct aio_kiocb {
>       struct list_head        ki_list;        /* the aio core uses this
>                                                * for cancellation */
>  
> +     unsigned int            flags;          /* protected by ctx->ctx_lock */
> +#define AIO_IOCB_DELAYED_CANCEL      (1 << 0)
> +#define AIO_IOCB_CANCELLED   (1 << 1)

BIT(0) and BIT(1)?

Anyway, not a big deal...

Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

Reply via email to