From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Tue, 15 Mar 2011 09:04:10 +0000 Subject: [Cluster-devel] RCU glock patch In-Reply-To: <20110314130728.GI2167@linux.vnet.ibm.com> References: <1294662318.2450.56.camel@dolmen> <20110313070422.GZ2234@linux.vnet.ibm.com> <1300096996.2573.16.camel@dolmen> <20110314130728.GI2167@linux.vnet.ibm.com> Message-ID: <1300179850.4025.2.camel@dolmen> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, On Mon, 2011-03-14 at 06:07 -0700, Paul E. McKenney wrote: > On Mon, Mar 14, 2011 at 10:03:16AM +0000, Steven Whitehouse wrote: [snip] > > > > + > > > > +static inline struct gfs2_glock *glock_hash_next(struct gfs2_glock *gl) > > > > +{ > > > > + return hlist_bl_entry(rcu_dereference_raw(gl->gl_list.next), > > > > > > Isn't this always called either with the update-side lock held or under > > > rcu_read_lock() protection? If so, please use rcu_dereference_protected(). > > > This probable means applying lockdep to the hash-chain locks, but that > > > should be doable. > > > > > There will always be rcu_read_lock() protection. These are used only by > > the seq_file based "glocks" file which appears in debugfs. I can try and > > create a patch to fix the dereference function, but I'm not sure what > > I'll need to do about lockdep. I guess I'll test it and see whether I > > get any messages from it. > > OK, if there is always rcu_read_lock() protection, then you can just use > rcu_dereference(). If lockdep is enabled, it will the the appropriate > checking. > Ok, cool. I've attached an incremental patch below. I'll send this to Linus with the rest of the queue shortly, Steve. >From 99f4f4266bf3619216a4de386921fdd7530e6b1e Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Tue, 15 Mar 2011 08:32:14 +0000 Subject: [PATCH] GFS2: Don't use _raw version of RCU dereference As per RCU glock patch review comments, don't use the _raw version of this function here. Signed-off-by: Steven Whitehouse Cc: Paul E. McKenney diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 8648409..85044b4 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1723,7 +1723,7 @@ static inline struct gfs2_glock *glock_hash_chain(unsigned hash) static inline struct gfs2_glock *glock_hash_next(struct gfs2_glock *gl) { - return hlist_bl_entry(rcu_dereference_raw(gl->gl_list.next), + return hlist_bl_entry(rcu_dereference(gl->gl_list.next), struct gfs2_glock, gl_list); } -- 1.7.4