How about this: /* The caller must hold either rcu_read_lock or ovs_mutex to keep the returned dp pointer valid. */
Jarno > On Jul 15, 2014, at 3:45 AM, Andy Zhou <az...@nicira.com> wrote: > > Since rcu_read_lock() is taken within the function. Caller is not > strictly required to take either rcu_read_lock() or a mutex lock. > > What you said is true in how we use this function. May be it should be > comments in the calling sits? > > >> On Mon, Jul 14, 2014 at 3:55 PM, Joe Stringer <joestrin...@nicira.com> wrote: >> Isn't this here to cover the case where the datapath disappears when it is >> returned to the caller? >> >> (In which case, perhaps we could explain this in the comment) >> >> >>> On 15 July 2014 09:55, Andy Zhou <az...@nicira.com> wrote: >>> >>> Signed-off-by: Andy Zhou <az...@nicira.com> >>> --- >>> datapath/datapath.c | 1 - >>> 1 file changed, 1 deletion(-) >>> >>> diff --git a/datapath/datapath.c b/datapath/datapath.c >>> index 065356f..1fd7bf3 100644 >>> --- a/datapath/datapath.c >>> +++ b/datapath/datapath.c >>> @@ -140,7 +140,6 @@ static int queue_gso_packets(struct datapath *dp, >>> struct sk_buff *, >>> static int queue_userspace_packet(struct datapath *dp, struct sk_buff *, >>> const struct dp_upcall_info *); >>> >>> -/* Must be called with rcu_read_lock or ovs_mutex. */ >>> static struct datapath *get_dp(struct net *net, int dp_ifindex) >>> { >>> struct datapath *dp = NULL; >>> -- >>> 1.9.1 >>> >>> _______________________________________________ >>> dev mailing list >>> dev@openvswitch.org >>> http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev