IB/qib: Fix sparse RCU warnings in qib_keys.c
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Fri, 6 Jul 2012 18:29:45 +0000 (18:29 +0000)
committerRoland Dreier <roland@purestorage.com>
Tue, 10 Jul 2012 17:01:56 +0000 (10:01 -0700)
Commit 8aac4cc3a9d7 ("IB/qib: RCU locking for MR validation") introduced
new sparse warnings in qib_keys.c.

Acked-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_keys.c
drivers/infiniband/hw/qib/qib_verbs.h

index 970165b027f72d7e9a31c0a671f03dbc5d466dc2..e9486c74c2262b5997aca9599971d625e9399677 100644 (file)
@@ -349,7 +349,9 @@ int qib_fast_reg_mr(struct qib_qp *qp, struct ib_send_wr *wr)
        if (pd->user || rkey == 0)
                goto bail;
 
-       mr = rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))];
+       mr = rcu_dereference_protected(
+               rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))],
+               lockdep_is_held(&rkt->lock));
        if (unlikely(mr == NULL || qp->ibqp.pd != mr->pd))
                goto bail;
 
index 85751fd743715c05cbd894a5f3ff0f477e1deb5e..1293133f28cb1a017a46db32ed41f4c5a9051f03 100644 (file)
@@ -650,7 +650,7 @@ struct qib_lkey_table {
        u32 next;               /* next unused index (speeds search) */
        u32 gen;                /* generation count */
        u32 max;                /* size of the table */
-       struct qib_mregion **table;
+       struct qib_mregion __rcu **table;
 };
 
 struct qib_opcode_stats {
@@ -732,7 +732,7 @@ struct qib_ibdev {
        struct list_head pending_mmaps;
        spinlock_t mmap_offset_lock; /* protect mmap_offset */
        u32 mmap_offset;
-       struct qib_mregion *dma_mr;
+       struct qib_mregion __rcu *dma_mr;
 
        /* QP numbers are shared by all IB ports */
        struct qib_qpn_table qpn_table;