summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0062-Unused-iocbs-in-a-batch-should-not-be-accounted-as-a.patch
diff options
context:
space:
mode:
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.patch71
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 @@
1From 0eeb9347d25c283bdbdd1a9e4d7d4881852887d1 Mon Sep 17 00:00:00 2001
2From: Gleb Natapov <gleb@redhat.com>
3Date: Sun, 8 Jan 2012 17:07:28 +0200
4Subject: [PATCH 062/129] Unused iocbs in a batch should not be accounted as
5 active.
6
7commit 69e4747ee9727d660b88d7e1efe0f4afcb35db1b upstream.
8
9Since commit 080d676de095 ("aio: allocate kiocbs in batches") iocbs are
10allocated in a batch during processing of first iocbs. All iocbs in a
11batch are automatically added to ctx->active_reqs list and accounted in
12ctx->reqs_active.
13
14If one (not the last one) of iocbs submitted by an user fails, further
15iocbs are not processed, but they are still present in ctx->active_reqs
16and accounted in ctx->reqs_active. This causes process to stuck in a D
17state in wait_for_all_aios() on exit since ctx->reqs_active will never
18go down to zero. Furthermore since kiocb_batch_free() frees iocb
19without removing it from active_reqs list the list become corrupted
20which may cause oops.
21
22Fix this by removing iocb from ctx->active_reqs and updating
23ctx->reqs_active in kiocb_batch_free().
24
25Signed-off-by: Gleb Natapov <gleb@redhat.com>
26Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
27Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
28Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
29---
30 fs/aio.c | 11 +++++++++--
31 1 file changed, 9 insertions(+), 2 deletions(-)
32
33diff --git a/fs/aio.c b/fs/aio.c
34index 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--
701.7.9.5
71