diff options
-rw-r--r-- | fs/aio.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1166,7 +1166,10 @@ retry: | |||
1166 | break; | 1166 | break; |
1167 | if (min_nr <= i) | 1167 | if (min_nr <= i) |
1168 | break; | 1168 | break; |
1169 | ret = 0; | 1169 | if (unlikely(ctx->dead)) { |
1170 | ret = -EINVAL; | ||
1171 | break; | ||
1172 | } | ||
1170 | if (to.timed_out) /* Only check after read evt */ | 1173 | if (to.timed_out) /* Only check after read evt */ |
1171 | break; | 1174 | break; |
1172 | /* Try to only show up in io wait if there are ops | 1175 | /* Try to only show up in io wait if there are ops |
@@ -1231,6 +1234,13 @@ static void io_destroy(struct kioctx *ioctx) | |||
1231 | 1234 | ||
1232 | aio_cancel_all(ioctx); | 1235 | aio_cancel_all(ioctx); |
1233 | wait_for_all_aios(ioctx); | 1236 | wait_for_all_aios(ioctx); |
1237 | |||
1238 | /* | ||
1239 | * Wake up any waiters. The setting of ctx->dead must be seen | ||
1240 | * by other CPUs at this point. Right now, we rely on the | ||
1241 | * locking done by the above calls to ensure this consistency. | ||
1242 | */ | ||
1243 | wake_up(&ioctx->wait); | ||
1234 | put_ioctx(ioctx); /* once for the lookup */ | 1244 | put_ioctx(ioctx); /* once for the lookup */ |
1235 | } | 1245 | } |
1236 | 1246 | ||