IB/srp: Document locking conventions
authorBart Van Assche <bart.vanassche@sandisk.com>
Tue, 14 Feb 2017 18:56:32 +0000 (10:56 -0800)
committerDoug Ledford <dledford@redhat.com>
Sun, 19 Feb 2017 14:51:53 +0000 (09:51 -0500)
Use lockdep_assert_held() statements to verify at run-time
whether the proper locks are held.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Israel Rukshin <israelr@mellanox.com>
Cc: Max Gurtovoy <maxg@mellanox.com>
Cc: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/ulp/srp/ib_srp.c

index d9b57f5958b5c6452dfa324b3966ccdb677a5194..862ee2ff5bb9178a4ed7976c9d6b826192279158 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/parser.h>
 #include <linux/random.h>
 #include <linux/jiffies.h>
+#include <linux/lockdep.h>
 #include <rdma/ib_cache.h>
 
 #include <linux/atomic.h>
@@ -1799,6 +1800,8 @@ static struct srp_iu *__srp_get_tx_iu(struct srp_rdma_ch *ch,
        s32 rsv = (iu_type == SRP_IU_TSK_MGMT) ? 0 : SRP_TSK_MGMT_SQ_SIZE;
        struct srp_iu *iu;
 
+       lockdep_assert_held(&ch->lock);
+
        ib_process_cq_direct(ch->send_cq, -1);
 
        if (list_empty(&ch->free_tx))
@@ -1829,6 +1832,8 @@ static void srp_send_done(struct ib_cq *cq, struct ib_wc *wc)
                return;
        }
 
+       lockdep_assert_held(&ch->lock);
+
        list_add(&iu->list, &ch->free_tx);
 }