RDS: purge atomic resources too in rds_message_purge()
authorAndy Grover <andy.grover@oracle.com>
Thu, 28 Jan 2010 00:15:48 +0000 (16:15 -0800)
committerAndy Grover <andy.grover@oracle.com>
Thu, 9 Sep 2010 01:11:57 +0000 (18:11 -0700)
Add atomic_free_op function, analogous to rdma_free_op,
and call it in rds_message_purge().

Signed-off-by: Andy Grover <andy.grover@oracle.com>
net/rds/message.c
net/rds/rdma.c
net/rds/rds.h

index a27e493a63a227e9d2c518f8bbcc7b33ffdef0d9..b53306c3e65605b832c59b216739b3bd9a2fa731 100644 (file)
@@ -73,6 +73,11 @@ static void rds_message_purge(struct rds_message *rm)
                rds_rdma_free_op(&rm->rdma.m_rdma_op);
        if (rm->rdma.m_rdma_mr)
                rds_mr_put(rm->rdma.m_rdma_mr);
+
+       if (rm->atomic.op_active)
+               rds_atomic_free_op(&rm->atomic);
+       if (rm->atomic.op_rdma_mr)
+               rds_mr_put(rm->atomic.op_rdma_mr);
 }
 
 void rds_message_put(struct rds_message *rm)
index 91967c8bc572eb5f057332992a07f0c2c6e4179f..0df86a382e2eaea7b50e7e2a0630b3d0b9e73b18 100644 (file)
@@ -462,6 +462,22 @@ void rds_rdma_free_op(struct rds_rdma_op *ro)
        ro->r_active = 0;
 }
 
+void rds_atomic_free_op(struct rm_atomic_op *ao)
+{
+       struct page *page = sg_page(ao->op_sg);
+
+       /* Mark page dirty if it was possibly modified, which
+        * is the case for a RDMA_READ which copies from remote
+        * to local memory */
+       set_page_dirty(page);
+       put_page(page);
+
+       kfree(ao->op_notifier);
+       ao->op_notifier = NULL;
+       ao->op_active = 0;
+}
+
+
 /*
  * Count the number of pages needed to describe an incoming iovec.
  */
index bf2349da4db7b790dad94a2c94663629004a2e85..32b3d46aea36520bd0b376d7652fde4b1c1b0b29 100644 (file)
@@ -745,6 +745,7 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
 int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm,
                          struct cmsghdr *cmsg);
 void rds_rdma_free_op(struct rds_rdma_op *ro);
+void rds_atomic_free_op(struct rm_atomic_op *ao);
 void rds_rdma_send_complete(struct rds_message *rm, int wc_status);
 void rds_atomic_send_complete(struct rds_message *rm, int wc_status);
 int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,