cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v2] GFS2: Use rht_for_each_entry_rcu in	glock_hash_walk
Date: Fri, 13 Nov 2015 08:36:31 -0500 (EST)	[thread overview]
Message-ID: <332659848.10441105.1447421791767.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1447417018-1856-1-git-send-email-anprice@redhat.com>

----- Original Message -----
> This lockdep splat was being triggered on umount:
> 
> [55715.973122] ===============================
> [55715.980169] [ INFO: suspicious RCU usage. ]
> [55715.981021] 4.3.0-11553-g8d3de01-dirty #15 Tainted: G        W
> [55715.982353] -------------------------------
> [55715.983301] fs/gfs2/glock.c:1427 suspicious rcu_dereference_protected()
> usage!
> 
> The code it refers to is the rht_for_each_entry_safe usage in
> glock_hash_walk. The condition that triggers the warning is
> lockdep_rht_bucket_is_held(tbl, hash) which is checked in the
> __rcu_dereference_protected macro.
> 
> The rhashtable buckets are not changed in glock_hash_walk so it's safe
> to rely on the rcu protection. Replace the rht_for_each_entry_safe()
> usage with rht_for_each_entry_rcu(), which doesn't care whether the
> bucket lock is held if the rcu read lock is held.
> 
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
>  fs/gfs2/glock.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 32e7471..430326e 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -1417,14 +1417,14 @@ static struct shrinker glock_shrinker = {
>  static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd
>  *sdp)
>  {
>  	struct gfs2_glock *gl;
> -	struct rhash_head *pos, *next;
> +	struct rhash_head *pos;
>  	const struct bucket_table *tbl;
>  	int i;
>  
>  	rcu_read_lock();
>  	tbl = rht_dereference_rcu(gl_hash_table.tbl, &gl_hash_table);
>  	for (i = 0; i < tbl->size; i++) {
> -		rht_for_each_entry_safe(gl, pos, next, tbl, i, gl_node) {
> +		rht_for_each_entry_rcu(gl, pos, tbl, i, gl_node) {
>  			if ((gl->gl_name.ln_sbd == sdp) &&
>  			    lockref_get_not_dead(&gl->gl_lockref))
>  				examiner(gl);
> --
> 2.4.3
> 
> 

ACK

I'll save it until after this merge window.

Bob Peterson
Red Hat File Systems



  parent reply	other threads:[~2015-11-13 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 17:20 [Cluster-devel] [PATCH] GFS2: Hold gl_hash_table bucket locks in glock_hash_walk Andrew Price
2015-11-12 20:11 ` Bob Peterson
2015-11-12 20:38   ` Steven Whitehouse
2015-11-13 11:48     ` Andrew Price
2015-11-13 12:16     ` [Cluster-devel] [PATCH v2] GFS2: Use rht_for_each_entry_rcu " Andrew Price
2015-11-13 12:19       ` Steven Whitehouse
2015-11-13 13:36       ` Bob Peterson [this message]
2015-11-16 18:13       ` Bob Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=332659848.10441105.1447421791767.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).