diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch deleted file mode 100644 index 1ca3eaef..00000000 --- a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | From 0eeb9347d25c283bdbdd1a9e4d7d4881852887d1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gleb Natapov <gleb@redhat.com> | ||
3 | Date: Sun, 8 Jan 2012 17:07:28 +0200 | ||
4 | Subject: [PATCH 062/129] Unused iocbs in a batch should not be accounted as | ||
5 | active. | ||
6 | |||
7 | commit 69e4747ee9727d660b88d7e1efe0f4afcb35db1b upstream. | ||
8 | |||
9 | Since commit 080d676de095 ("aio: allocate kiocbs in batches") iocbs are | ||
10 | allocated in a batch during processing of first iocbs. All iocbs in a | ||
11 | batch are automatically added to ctx->active_reqs list and accounted in | ||
12 | ctx->reqs_active. | ||
13 | |||
14 | If one (not the last one) of iocbs submitted by an user fails, further | ||
15 | iocbs are not processed, but they are still present in ctx->active_reqs | ||
16 | and accounted in ctx->reqs_active. This causes process to stuck in a D | ||
17 | state in wait_for_all_aios() on exit since ctx->reqs_active will never | ||
18 | go down to zero. Furthermore since kiocb_batch_free() frees iocb | ||
19 | without removing it from active_reqs list the list become corrupted | ||
20 | which may cause oops. | ||
21 | |||
22 | Fix this by removing iocb from ctx->active_reqs and updating | ||
23 | ctx->reqs_active in kiocb_batch_free(). | ||
24 | |||
25 | Signed-off-by: Gleb Natapov <gleb@redhat.com> | ||
26 | Reviewed-by: Jeff Moyer <jmoyer@redhat.com> | ||
27 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | ||
28 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | ||
29 | --- | ||
30 | fs/aio.c | 11 +++++++++-- | ||
31 | 1 file changed, 9 insertions(+), 2 deletions(-) | ||
32 | |||
33 | diff --git a/fs/aio.c b/fs/aio.c | ||
34 | index 78c514c..969beb0 100644 | ||
35 | --- a/fs/aio.c | ||
36 | +++ b/fs/aio.c | ||
37 | @@ -476,14 +476,21 @@ static void kiocb_batch_init(struct kiocb_batch *batch, long total) | ||
38 | batch->count = total; | ||
39 | } | ||
40 | |||
41 | -static void kiocb_batch_free(struct kiocb_batch *batch) | ||
42 | +static void kiocb_batch_free(struct kioctx *ctx, struct kiocb_batch *batch) | ||
43 | { | ||
44 | struct kiocb *req, *n; | ||
45 | |||
46 | + if (list_empty(&batch->head)) | ||
47 | + return; | ||
48 | + | ||
49 | + spin_lock_irq(&ctx->ctx_lock); | ||
50 | list_for_each_entry_safe(req, n, &batch->head, ki_batch) { | ||
51 | list_del(&req->ki_batch); | ||
52 | + list_del(&req->ki_list); | ||
53 | kmem_cache_free(kiocb_cachep, req); | ||
54 | + ctx->reqs_active--; | ||
55 | } | ||
56 | + spin_unlock_irq(&ctx->ctx_lock); | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | @@ -1742,7 +1749,7 @@ long do_io_submit(aio_context_t ctx_id, long nr, | ||
61 | } | ||
62 | blk_finish_plug(&plug); | ||
63 | |||
64 | - kiocb_batch_free(&batch); | ||
65 | + kiocb_batch_free(ctx, &batch); | ||
66 | put_ioctx(ctx); | ||
67 | return i ? i : ret; | ||
68 | } | ||
69 | -- | ||
70 | 1.7.9.5 | ||
71 | |||