Re: [PATCH] dropmon: add ability to detect when hardware dropsrxpackets

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Friday, May 15, 2009 - 11:11 am

Neil Horman a écrit :

This is racy, unless caller already owns a lock.

If caller aleady owns a lock, you dont need :

rcu_read_lock()
list_for_each_entry_rcu()
rcu_read_unlock();





Its not clear that you use trace_state_lock as the lock guarding all this.

If this is the case I suggest a plain and straight forward :

case NETDEV_UNREGISTER:
	spin_lock(&trace_state_lock);
	if (trace_state == TRACE_OFF) {
		list_for_each_entry(new_stat, &hw_stats_list, list) {
			if (new_stat->dev == dev) {
				new_stat->dev = NULL;
				list_del_rcu(&new_stat->list);
				call_rcu(&new_stat->rcu, free_dm_hw_stat);
				break;
			}
		}
	}
	spin_unlock(&trace_state_lock);
	break;


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] dropmon: add ability to detect when hardware d ..., Eric Dumazet, (Fri May 15, 11:11 am)
Re: [PATCH] dropmon: add ability to detect when hardware d ..., Stephen Hemminger, (Fri May 15, 11:18 am)
Re: [PATCH] dropmon: add ability to detect when hardware d ..., Stephen Hemminger, (Fri May 15, 11:23 am)