Fixed the following issue reported by lockdep:
authorbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 3 Jul 2009 19:15:15 +0000 (19:15 +0000)
committerbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 3 Jul 2009 19:15:15 +0000 (19:15 +0000)
 ------------[ cut here ]------------
WARNING: at kernel/lockdep.c:2197 trace_hardirqs_on_caller+0x14c/0x1b0()
Call Trace:
 <IRQ>
 [<ffffffff8024636f>] warn_slowpath+0xaf/0x110
 [<ffffffff8026e1be>] ? check_usage_forwards+0x5e/0xc0
 [<ffffffff8026e818>] ? mark_lock+0x538/0xcc0
 [<ffffffff802ccfc1>] ? cache_alloc_refill+0x191/0x2b0
 [<ffffffff804ee62b>] ? _spin_unlock_irq+0x2b/0x40
 [<ffffffff8026f23c>] trace_hardirqs_on_caller+0x14c/0x1b0
 [<ffffffff8026f2ad>] trace_hardirqs_on+0xd/0x10
 [<ffffffff804ee62b>] _spin_unlock_irq+0x2b/0x40
 [<ffffffffa0657711>] srpt_handle_new_iu+0x2f1/0x630 [ib_srpt]
 [<ffffffffa0657bab>] srpt_completion+0x15b/0x300 [ib_srpt]
 [<ffffffffa04321f2>] mlx4_ib_cq_comp+0x12/0x20 [mlx4_ib]
 [<ffffffffa01f42aa>] mlx4_cq_completion+0x3a/0x80 [mlx4_core]
 [<ffffffffa01f5585>] mlx4_eq_int+0x295/0x2a0 [mlx4_core]
 [<ffffffffa01f561f>] mlx4_msi_x_interrupt+0xf/0x20 [mlx4_core]
 [<ffffffff80288565>] handle_IRQ_event+0x35/0x70
 [<ffffffff8028a144>] handle_edge_irq+0xb4/0x150
 [<ffffffff8020eb71>] do_IRQ+0x81/0x110
 [<ffffffff8020ced3>] ret_from_intr+0x0/0xf
 <EOI>
 [<ffffffff803b1a88>] ? cfb_imageblit+0x578/0x5a0
 [<ffffffff803aaf09>] ? bit_putcs+0x3d9/0x6a0
 [<ffffffff8026f252>] ? trace_hardirqs_on_caller+0x162/0x1b0
 [<ffffffff8026f2ad>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff804eb425>] ? thread_return+0x3d/0x928
 [<ffffffff803ab49b>] ? soft_cursor+0x1ab/0x220
 [<ffffffff803aaac7>] ? bit_cursor+0x647/0x6b0
 [<ffffffff803a4a9b>] ? fbcon_putcs+0x1cb/0x320
 [<ffffffff803aab30>] ? bit_putcs+0x0/0x6a0
 [<ffffffff803a7506>] ? fbcon_redraw+0x166/0x1d0
 [<ffffffff803a7770>] ? fbcon_scroll+0x200/0xd50
 [<ffffffff803f7af0>] ? scrup+0x100/0x110
 [<ffffffff803f7c7d>] ? lf+0x6d/0x70
 [<ffffffff803fbb1d>] ? do_con_write+0x9dd/0x2300
 [<ffffffff8026eff6>] ? mark_held_locks+0x56/0xa0
 [<ffffffff8026f252>] ? trace_hardirqs_on_caller+0x162/0x1b0
 [<ffffffff803fd499>] ? con_write+0x19/0x30
 [<ffffffff803ea683>] ? n_tty_write+0x383/0x480
 [<ffffffff8026f2ad>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff8023d7d0>] ? default_wake_function+0x0/0x10
 [<ffffffff803e76f4>] ? tty_write+0x1b4/0x280
 [<ffffffff803ea300>] ? n_tty_write+0x0/0x480
 [<ffffffff802d312b>] ? vfs_write+0xcb/0x170
 [<ffffffff802d32c0>] ? sys_write+0x50/0x90
 [<ffffffff8020c51b>] ? system_call_fastpath+0x16/0x1b
 ---[ end trace 954f4d9b9b9cdecc ]---

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@931 d57e44dd-8a1f-0410-8b47-8ef2f437770f

srpt/src/ib_srpt.c

index d4a0458..f8ec3d8 100644 (file)
@@ -911,6 +911,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx)
        scst_data_direction dir = SCST_DATA_NONE;
        int indirect_desc = 0;
        int ret;
+       unsigned long flags;
 
        srp_cmd = ioctx->buf;
 
@@ -976,10 +977,10 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx)
        scst_cmd_set_tgt_priv(scmnd, ioctx);
        scst_cmd_set_expected(scmnd, dir, ioctx->data_len);
 
-       spin_lock_irq(&ch->spinlock);
+       spin_lock_irqsave(&ch->spinlock, flags);
        list_add_tail(&ioctx->scmnd_list, &ch->active_scmnd_list);
        ch->active_scmnd_cnt++;
-       spin_unlock_irq(&ch->spinlock);
+       spin_unlock_irqrestore(&ch->spinlock, flags);
 
        scst_cmd_init_done(scmnd, scst_estimate_context());
 
@@ -1083,12 +1084,13 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
                               struct srpt_ioctx *ioctx)
 {
        u8 op;
+       unsigned long flags;
 
        if (ch->state != RDMA_CHANNEL_LIVE) {
                if (ch->state == RDMA_CHANNEL_CONNECTING) {
-                       spin_lock_irq(&ch->spinlock);
+                       spin_lock_irqsave(&ch->spinlock, flags);
                        list_add_tail(&ioctx->wait_list, &ch->cmd_wait_list);
-                       spin_unlock_irq(&ch->spinlock);
+                       spin_unlock_irqrestore(&ch->spinlock, flags);
                } else
                        srpt_reset_ioctx(ch, ioctx);