netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drop_monitor: Add error code to detect duplicate state changes
@ 2010-07-20 14:52 Neil Horman
  2010-07-20 20:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Horman @ 2010-07-20 14:52 UTC (permalink / raw)
  To: netdev; +Cc: davem, nhorman

Hey-
	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 <nhorman@tuxdriver.com>


 drop_monitor.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)


diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index ad41529..646ef3b 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -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);
@@ -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;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drop_monitor: Add error code to detect duplicate state changes
  2010-07-20 14:52 [PATCH] drop_monitor: Add error code to detect duplicate state changes Neil Horman
@ 2010-07-20 20:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-07-20 20:28 UTC (permalink / raw)
  To: nhorman; +Cc: netdev

From: Neil Horman <nhorman@tuxdriver.com>
Date: Tue, 20 Jul 2010 10:52:09 -0400

> Hey-
> 	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 <nhorman@tuxdriver.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-20 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 14:52 [PATCH] drop_monitor: Add error code to detect duplicate state changes Neil Horman
2010-07-20 20:28 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).