Skip to content

Commit

Permalink
drop_monitor: Add error code to detect duplicate state changes
Browse files Browse the repository at this point in the history
	Patch to add -EAGAIN error to dropwatch netlink message handling code.
-EAGAIN will be returned anytime userspace attempts to transition the state of
the drop monitor service to a state that its already in.  That allows user space
to detect this condition, so it doesn't wait for a success ACK that will never
arrive.  Tested successfully by me

Signed-off-by: Neil Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
nhorman authored and davem330 committed Jul 20, 2010
1 parent d79d991 commit 4b70637
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/core/drop_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ static int set_all_monitor_traces(int state)

spin_lock(&trace_state_lock);

if (state == trace_state) {
rc = -EAGAIN;
goto out_unlock;
}

switch (state) {
case TRACE_ON:
rc |= register_trace_kfree_skb(trace_kfree_skb_hit, NULL);
Expand Down Expand Up @@ -251,11 +256,12 @@ static int set_all_monitor_traces(int state)

if (!rc)
trace_state = state;
else
rc = -EINPROGRESS;

out_unlock:
spin_unlock(&trace_state_lock);

if (rc)
return -EINPROGRESS;
return rc;
}

Expand Down

0 comments on commit 4b70637

Please sign in to comment.