diff --git a/[refs] b/[refs] index 5a7bbb0703e4..b80404a65885 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 180c06efce691f2b721dd0d965079827bdd7ee03 +refs/heads/master: e92adcba261fd391591bb63c1703185a04a41554 diff --git a/trunk/fs/aio.c b/trunk/fs/aio.c index 228368610dfa..ae94e1dea266 100644 --- a/trunk/fs/aio.c +++ b/trunk/fs/aio.c @@ -1166,7 +1166,10 @@ static int read_events(struct kioctx *ctx, break; if (min_nr <= i) break; - ret = 0; + if (unlikely(ctx->dead)) { + ret = -EINVAL; + break; + } if (to.timed_out) /* Only check after read evt */ break; /* Try to only show up in io wait if there are ops @@ -1231,6 +1234,13 @@ static void io_destroy(struct kioctx *ioctx) aio_cancel_all(ioctx); wait_for_all_aios(ioctx); + + /* + * Wake up any waiters. The setting of ctx->dead must be seen + * by other CPUs at this point. Right now, we rely on the + * locking done by the above calls to ensure this consistency. + */ + wake_up(&ioctx->wait); put_ioctx(ioctx); /* once for the lookup */ }