[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110127.122824.193719098.davem@davemloft.net>
Date: Thu, 27 Jan 2011 12:28:24 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [RFC PATCH] net: Implement read-only protection and COW'ing of
metrics.
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 27 Jan 2011 11:01:51 +0100
> Since you use cmpxchg() to permut the dst->_metrics, I feel this rt->fi
> needs some protection as well. Maybe store fi pointer inside the metrics
> instead of dst, or else you need a spinlock to perform the whole
> transaction (change dst->_metrics & rt->fi) ?
I think this is OK, because there are only two points at which the
"rt->fi" is tested and (conditionally) released.
1) At dst destruction time, which is when no other references may
exist to the dst.
2) At COW time, and here we know a) we are the one and only entity
which successfully COW'd the metrics and b) there is at least our
reference to the dst and therefore dst destroy (and therefore case
#1) may not execute in parallel with us.
So I think it's safe.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists