Re: FAILED: patch "[PATCH] aio: block exit_aio() until all context requests are" failed to apply to 3.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2014-09-20 at 10:50 -0700, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> The patch below does not apply to the 3.16-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@xxxxxxxxxxxxxxx>.
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
> From 6098b45b32e6baeacc04790773ced9340601d511 Mon Sep 17 00:00:00 2001
> From: Gu Zheng <guz.fnst@xxxxxxxxxxxxxx>
> Date: Wed, 3 Sep 2014 17:45:44 +0800
> Subject: [PATCH] aio: block exit_aio() until all context requests are
>  completed
[...]

Another straightforward backport, compile-tested only.

Ben.

-- 
Ben Hutchings
Hoare's Law of Large Problems:
        Inside every large problem is a small problem struggling to get out.
From f5903d7f76eab6bcf25ac8c328dc122bbbbc3ac8 Mon Sep 17 00:00:00 2001
From: Gu Zheng <guz.fnst@xxxxxxxxxxxxxx>
Date: Wed, 3 Sep 2014 17:45:44 +0800
Subject: [PATCH] aio: block exit_aio() until all context requests are
 completed

commit 6098b45b32e6baeacc04790773ced9340601d511 upstream.

It seems that exit_aio() also needs to wait for all iocbs to complete (like
io_destroy), but we missed the wait step in current implemention, so fix
it in the same way as we did in io_destroy.

Signed-off-by: Gu Zheng <guz.fnst@xxxxxxxxxxxxxx>
Signed-off-by: Benjamin LaHaise <bcrl@xxxxxxxxx>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
 fs/aio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 1c9c5f0..f09234c 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -796,6 +796,9 @@ void exit_aio(struct mm_struct *mm)
 	unsigned i = 0;
 
 	while (1) {
+		struct completion requests_done =
+			COMPLETION_INITIALIZER_ONSTACK(requests_done);
+
 		rcu_read_lock();
 		table = rcu_dereference(mm->ioctx_table);
 
@@ -823,7 +826,10 @@ void exit_aio(struct mm_struct *mm)
 		 */
 		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);
 	}
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]