From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sven Eckelmann Date: Thu, 16 Sep 2010 22:18:33 +0200 Message-Id: <1284668317-19890-1-git-send-email-sven.eckelmann@gmx.de> Subject: [B.A.T.M.A.N.] Initial rcu locking patchset Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.net Hi, I tried to check through the code and identify problems not yet mentioned by Paul E. McKenney. They were found by reading through Documentation/RCU/checklist.txt and related documents in the folder. It doesn't address the reference counting problem for gw_nodes and interfaces. Those leaks are happen in gw_election, get_batman_if_by_netdev and get_active_batman_if. We must increase the refcnt (using atomic_inc) inside the rcu_read_lock()..rcu_read_unlock() before we attach to the structure it "leaks". When another function now removed it from its usage context (primary_if, usage on stack, ...) then atomic_dec_and_test the refcnt. If it is decremented to zero then we can issue the call_rcu to the freeing function. So "put" of those functions is not allowed inside an rcu_read_lock. As said before the hold must always be called inside a rcu_read_lock. Best regards, Sven