From: Tatyana Nikolova Date: Sun, 25 Nov 2012 06:46:24 +0000 (-0600) Subject: RDMA/nes: Fix for crash when adding timer and timer is pending X-Git-Tag: vofed-3.5-x~13 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=091960b359aca219d12704689a82393372ff1abe;p=~emulex%2Ftmp%2Fcompat-rdma%2F.git RDMA/nes: Fix for crash when adding timer and timer is pending RDMA/nes: Replace with 0025-RDMA-nes-Fix-for-adding-timer.patch with 0025-RDMA-nes-Fix-for-modifying-tcp-timer.patch Signed-off-by: Tatyana Nikolova --- diff --git a/linux-next-pending/0025-RDMA-nes-Fix-for-adding-timer.patch b/linux-next-pending/0025-RDMA-nes-Fix-for-adding-timer.patch deleted file mode 100644 index 13f9a29..0000000 --- a/linux-next-pending/0025-RDMA-nes-Fix-for-adding-timer.patch +++ /dev/null @@ -1,23 +0,0 @@ -Fix for kernel panic caused by adding a timer when a timer is already pending. - -Signed-off-by: Tatyana Nikolova ---- - drivers/infiniband/hw/nes/nes_cm.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c -index cfaacaf..c04bfca 100644 ---- a/drivers/infiniband/hw/nes/nes_cm.c -+++ b/drivers/infiniband/hw/nes/nes_cm.c -@@ -727,7 +727,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, - - if (!was_timer_set) { - cm_core->tcp_timer.expires = new_send->timetosend; -- add_timer(&cm_core->tcp_timer); -+ mod_timer(&cm_core->tcp_timer, cm_core->tcp_timer.expires); - } - - return ret; --- -1.7.4.2 - diff --git a/linux-next-pending/0025-RDMA-nes-Fix-for-modifying-tcp-timer.patch b/linux-next-pending/0025-RDMA-nes-Fix-for-modifying-tcp-timer.patch new file mode 100644 index 0000000..129ccec --- /dev/null +++ b/linux-next-pending/0025-RDMA-nes-Fix-for-modifying-tcp-timer.patch @@ -0,0 +1,74 @@ +Fix for kernel BUG_ON when adding timer and a timer is already pending. +To avoid nes tcp_timer crash for SMP architectures, add_timer is replaced with mod_timer. + +Signed-off-by: Tatyana Nikolova +--- + drivers/infiniband/hw/nes/nes_cm.c | 24 ++++++------------------ + 1 files changed, 6 insertions(+), 18 deletions(-) + +diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c +index cfaacaf..7bee158 100644 +--- a/drivers/infiniband/hw/nes/nes_cm.c ++++ b/drivers/infiniband/hw/nes/nes_cm.c +@@ -671,7 +671,6 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, + struct nes_cm_core *cm_core = cm_node->cm_core; + struct nes_timer_entry *new_send; + int ret = 0; +- u32 was_timer_set; + + new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC); + if (!new_send) +@@ -723,12 +722,8 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, + } + } + +- was_timer_set = timer_pending(&cm_core->tcp_timer); +- +- if (!was_timer_set) { +- cm_core->tcp_timer.expires = new_send->timetosend; +- add_timer(&cm_core->tcp_timer); +- } ++ if (!timer_pending(&cm_core->tcp_timer)) ++ mod_timer(&cm_core->tcp_timer, new_send->timetosend); + + return ret; + } +@@ -946,10 +941,8 @@ static void nes_cm_timer_tick(unsigned long pass) + } + + if (settimer) { +- if (!timer_pending(&cm_core->tcp_timer)) { +- cm_core->tcp_timer.expires = nexttimeout; +- add_timer(&cm_core->tcp_timer); +- } ++ if (!timer_pending(&cm_core->tcp_timer)) ++ mod_timer(&cm_core->tcp_timer, nexttimeout); + } + } + +@@ -1314,8 +1307,6 @@ static int mini_cm_del_listen(struct nes_cm_core *cm_core, + static inline int mini_cm_accelerated(struct nes_cm_core *cm_core, + struct nes_cm_node *cm_node) + { +- u32 was_timer_set; +- + cm_node->accelerated = 1; + + if (cm_node->accept_pend) { +@@ -1325,11 +1316,8 @@ static inline int mini_cm_accelerated(struct nes_cm_core *cm_core, + BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0); + } + +- was_timer_set = timer_pending(&cm_core->tcp_timer); +- if (!was_timer_set) { +- cm_core->tcp_timer.expires = jiffies + NES_SHORT_TIME; +- add_timer(&cm_core->tcp_timer); +- } ++ if (!timer_pending(&cm_core->tcp_timer)) ++ mod_timer(&cm_core->tcp_timer, (jiffies + NES_SHORT_TIME)); + + return 0; + } +-- +1.7.4.2 +