提交 abfda471 编写于 作者: M Michael Ellerman 提交者: Jeff Garzik

[PATCH] iseries_veth: Remove a FIXME WRT deletion of the ack_timer

The iseries_veth driver has a timer which we use to send acks. When the
connection is reset or stopped we need to delete the timer.

Currently we only call del_timer() when resetting a connection, which means
the timer might run again while the connection is being re-setup. As it turns
out that's ok, because the flags the timer consults have been reset.

It's cleaner though to call del_timer_sync() once we've dropped the lock,
although the timer may still run between us dropping the lock and calling
del_timer_sync(), but as above that's ok.
Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 61a3c696
...@@ -450,13 +450,15 @@ static void veth_statemachine(void *p) ...@@ -450,13 +450,15 @@ static void veth_statemachine(void *p)
if (cnx->state & VETH_STATE_RESET) { if (cnx->state & VETH_STATE_RESET) {
int i; int i;
del_timer(&cnx->ack_timer);
if (cnx->state & VETH_STATE_OPEN) if (cnx->state & VETH_STATE_OPEN)
HvCallEvent_closeLpEventPath(cnx->remote_lp, HvCallEvent_closeLpEventPath(cnx->remote_lp,
HvLpEvent_Type_VirtualLan); HvLpEvent_Type_VirtualLan);
/* reset ack data */ /*
* Reset ack data. This prevents the ack_timer actually
* doing anything, even if it runs one more time when
* we drop the lock below.
*/
memset(&cnx->pending_acks, 0xff, sizeof (cnx->pending_acks)); memset(&cnx->pending_acks, 0xff, sizeof (cnx->pending_acks));
cnx->num_pending_acks = 0; cnx->num_pending_acks = 0;
...@@ -469,9 +471,16 @@ static void veth_statemachine(void *p) ...@@ -469,9 +471,16 @@ static void veth_statemachine(void *p)
if (cnx->msgs) if (cnx->msgs)
for (i = 0; i < VETH_NUMBUFFERS; ++i) for (i = 0; i < VETH_NUMBUFFERS; ++i)
veth_recycle_msg(cnx, cnx->msgs + i); veth_recycle_msg(cnx, cnx->msgs + i);
/* Drop the lock so we can do stuff that might sleep or
* take other locks. */
spin_unlock_irq(&cnx->lock); spin_unlock_irq(&cnx->lock);
del_timer_sync(&cnx->ack_timer);
veth_flush_pending(cnx); veth_flush_pending(cnx);
spin_lock_irq(&cnx->lock); spin_lock_irq(&cnx->lock);
if (cnx->state & VETH_STATE_RESET) if (cnx->state & VETH_STATE_RESET)
goto restart; goto restart;
} }
...@@ -658,13 +667,9 @@ static void veth_stop_connection(u8 rlp) ...@@ -658,13 +667,9 @@ static void veth_stop_connection(u8 rlp)
veth_kick_statemachine(cnx); veth_kick_statemachine(cnx);
spin_unlock_irq(&cnx->lock); spin_unlock_irq(&cnx->lock);
/* Wait for the state machine to run. */
flush_scheduled_work(); flush_scheduled_work();
/* FIXME: not sure if this is necessary - will already have
* been deleted by the state machine, just want to make sure
* its not running any more */
del_timer_sync(&cnx->ack_timer);
if (cnx->num_events > 0) if (cnx->num_events > 0)
mf_deallocate_lp_events(cnx->remote_lp, mf_deallocate_lp_events(cnx->remote_lp,
HvLpEvent_Type_VirtualLan, HvLpEvent_Type_VirtualLan,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册