mirror of https://gitee.com/openkylin/linux.git
Merge git://git.kvack.org/~bcrl/aio-fixes
Pull aio bugfixes from Ben LaHaise: "Two small fixes" * git://git.kvack.org/~bcrl/aio-fixes: aio: block exit_aio() until all context requests are completed aio: add missing smp_rmb() in read_events_ring
This commit is contained in:
commit
b7fece1be8
13
fs/aio.c
13
fs/aio.c
|
@ -793,6 +793,8 @@ void exit_aio(struct mm_struct *mm)
|
||||||
|
|
||||||
for (i = 0; i < table->nr; ++i) {
|
for (i = 0; i < table->nr; ++i) {
|
||||||
struct kioctx *ctx = table->table[i];
|
struct kioctx *ctx = table->table[i];
|
||||||
|
struct completion requests_done =
|
||||||
|
COMPLETION_INITIALIZER_ONSTACK(requests_done);
|
||||||
|
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
continue;
|
continue;
|
||||||
|
@ -804,7 +806,10 @@ void exit_aio(struct mm_struct *mm)
|
||||||
* that it needs to unmap the area, just set it to 0.
|
* that it needs to unmap the area, just set it to 0.
|
||||||
*/
|
*/
|
||||||
ctx->mmap_size = 0;
|
ctx->mmap_size = 0;
|
||||||
kill_ioctx(mm, ctx, NULL);
|
kill_ioctx(mm, ctx, &requests_done);
|
||||||
|
|
||||||
|
/* Wait until all IO for the context are done. */
|
||||||
|
wait_for_completion(&requests_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
RCU_INIT_POINTER(mm->ioctx_table, NULL);
|
RCU_INIT_POINTER(mm->ioctx_table, NULL);
|
||||||
|
@ -1111,6 +1116,12 @@ static long aio_read_events_ring(struct kioctx *ctx,
|
||||||
tail = ring->tail;
|
tail = ring->tail;
|
||||||
kunmap_atomic(ring);
|
kunmap_atomic(ring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ensure that once we've read the current tail pointer, that
|
||||||
|
* we also see the events that were stored up to the tail.
|
||||||
|
*/
|
||||||
|
smp_rmb();
|
||||||
|
|
||||||
pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events);
|
pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events);
|
||||||
|
|
||||||
if (head == tail)
|
if (head == tail)
|
||||||
|
|
Loading…
Reference in New Issue