[Cluster-devel] RCU glock patch

Steven Whitehouse swhiteho at redhat.com
Tue Mar 15 09:04:10 UTC 2011


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 <swhiteho at redhat.com>
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 <swhiteho at redhat.com>
Cc: Paul E. McKenney <paulmck at linux.vnet.ibm.com>

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






More information about the Cluster-devel mailing list