Patch "RDMA/cma: Simplify DEVICE_REMOVAL for internal_id" has been added to the 5.8-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    RDMA/cma: Simplify DEVICE_REMOVAL for internal_id

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-cma-simplify-device_removal-for-internal_id.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4decc6be3d3af1da5b7ab670258fc05f2c966bb5
Author: Jason Gunthorpe <jgg@xxxxxxxxxx>
Date:   Thu Jul 23 10:07:04 2020 +0300

    RDMA/cma: Simplify DEVICE_REMOVAL for internal_id
    
    [ Upstream commit d54f23c09ec62670901f1a2a4712a5218522ca2b ]
    
    cma_process_remove() triggers an unconditional rdma_destroy_id() for
    internal_id's and skips the event deliver and transition through
    RDMA_CM_DEVICE_REMOVAL.
    
    This is confusing and unnecessary. internal_id always has
    cma_listen_handler() as the handler, have it catch the
    RDMA_CM_DEVICE_REMOVAL event and directly consume it and signal removal.
    
    This way the FSM sequence never skips the DEVICE_REMOVAL case and the
    logic in this hard to test area is simplified.
    
    Link: https://lore.kernel.org/r/20200723070707.1771101-2-leon@xxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index c30cf5307ce3e..537eeebde5f4d 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2482,6 +2482,10 @@ static int cma_listen_handler(struct rdma_cm_id *id,
 {
 	struct rdma_id_private *id_priv = id->context;
 
+	/* Listening IDs are always destroyed on removal */
+	if (event->event == RDMA_CM_EVENT_DEVICE_REMOVAL)
+		return -1;
+
 	id->context = id_priv->id.context;
 	id->event_handler = id_priv->id.event_handler;
 	trace_cm_event_handler(id_priv, event);
@@ -4829,7 +4833,7 @@ static void cma_process_remove(struct cma_device *cma_dev)
 		cma_id_get(id_priv);
 		mutex_unlock(&lock);
 
-		ret = id_priv->internal_id ? 1 : cma_remove_id_dev(id_priv);
+		ret = cma_remove_id_dev(id_priv);
 		cma_id_put(id_priv);
 		if (ret)
 			rdma_destroy_id(&id_priv->id);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux