File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,13 @@ void kiocb_set_cancel_fn(struct kiocb *iocb, kiocb_cancel_fn *cancel)
568568 struct kioctx * ctx = req -> ki_ctx ;
569569 unsigned long flags ;
570570
571+ /*
572+ * kiocb didn't come from aio or is neither a read nor a write, hence
573+ * ignore it.
574+ */
575+ if (!(iocb -> ki_flags & IOCB_AIO_RW ))
576+ return ;
577+
571578 if (WARN_ON_ONCE (!list_empty (& req -> ki_list )))
572579 return ;
573580
@@ -1453,7 +1460,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb)
14531460 req -> ki_complete = aio_complete_rw ;
14541461 req -> private = NULL ;
14551462 req -> ki_pos = iocb -> aio_offset ;
1456- req -> ki_flags = iocb_flags (req -> ki_filp );
1463+ req -> ki_flags = iocb_flags (req -> ki_filp ) | IOCB_AIO_RW ;
14571464 if (iocb -> aio_flags & IOCB_FLAG_RESFD )
14581465 req -> ki_flags |= IOCB_EVENTFD ;
14591466 req -> ki_hint = ki_hint_validate (file_write_hint (req -> ki_filp ));
Original file line number Diff line number Diff line change @@ -322,6 +322,8 @@ enum rw_hint {
322322#define IOCB_NOIO (1 << 20)
323323/* can use bio alloc cache */
324324#define IOCB_ALLOC_CACHE (1 << 21)
325+ /* kiocb is a read or write operation submitted by fs/aio.c. */
326+ #define IOCB_AIO_RW (1 << 23)
325327
326328struct kiocb {
327329 struct file * ki_filp ;
You can’t perform that action at this time.
0 commit comments