[PATCH V3 5/6] RDMA CM: Save Owning PID

Nir Muchtar
2010-12-13T16:22:49Z

Save owning PID to id-priv when creating id's/accepting connections.

Signed-off-by: Nir Muchtar <nirm-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/core/cma.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 5821f93..9629a90 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -134,6 +134,7 @@ struct rdma_id_private {
u32 qp_num;
u8 srq;
u8 tos;
+ pid_t owner;
};

struct cma_multicast {
@@ -418,6 +419,7 @@ struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
if (!id_priv)
return ERR_PTR(-ENOMEM);

+ id_priv->owner = current->pid;
id_priv->state = RDMA_CM_IDLE;
id_priv->id.context = context;
id_priv->id.event_handler = event_handler;
@@ -2671,8 +2673,14 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
{
struct rdma_id_private *id_priv;
int ret;
+ unsigned long flags;

id_priv = container_of(id, struct rdma_id_private, id);
+
+ spin_lock_irqsave(&id_priv->lock, flags);
+ id_priv->owner = current->pid;
+ spin_unlock_irqrestore(&id_priv->lock, flags);
+
if (!cma_comp(id_priv, RDMA_CM_CONNECT))
return -EINVAL;

--
1.7.1