[openib-general] [PATCH] IB/ucm: fix deadlock in cleanup

Sean Hefty sean.hefty at intel.com
Tue Nov 28 11:55:42 PST 2006


I don't remember the status for this patch, but it should be queued for 2.6.20.
Roland, do you need Michael to resubmit?

>ib_ucm_cleanup_events has file_mutex while calling ib_destroy_cm_id.
>It seems this can deadlock since ib_destroy_cm_id flushes event
>handlers, and ib_ucm_event_handler needs file_mutex, too.
>
>Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
>
>---
>
>I'll be testing the following the next night - but it seems a right
>thing to do regardless of whether it fixes the issues I reported
>earlier. Sean, does this make sense to you? If yes, please ack for 2.6.19.
>
>diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
>index ad4f4d5..0128288 100644
>--- a/drivers/infiniband/core/ucm.c
>+++ b/drivers/infiniband/core/ucm.c
>@@ -161,12 +161,14 @@ static void ib_ucm_cleanup_events(struct
> 				    struct ib_ucm_event, ctx_list);
> 		list_del(&uevent->file_list);
> 		list_del(&uevent->ctx_list);
>+		mutex_unlock(&ctx->file->file_mutex);
>
> 		/* clear incoming connections. */
> 		if (ib_ucm_new_cm_id(uevent->resp.event))
> 			ib_destroy_cm_id(uevent->cm_id);
>
> 		kfree(uevent);
>+		mutex_lock(&ctx->file->file_mutex);
> 	}
> 	mutex_unlock(&ctx->file->file_mutex);
> }
>
>
>
>--
>MST




More information about the general mailing list