From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Fix up some sparse warnings
Date: Fri, 18 Aug 2017 16:52:00 +0100 [thread overview]
Message-ID: <20170818155159.GC12296@cicero> (raw)
In-Reply-To: <359006668.1872591.1503066056464.JavaMail.zimbra@redhat.com>
On Fri, Aug 18, 2017 at 10:20:56AM -0400, Bob Peterson wrote:
> Hi,
>
> This patch cleans up various pieces of GFS2 to avoid sparse errors.
> This doesn't fix them all, but it fixes several. The first error,
> in function glock_hash_walk was a genuine bug where the rhashtable
> could be started and not stopped.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index ffca19598525..db78720f3c89 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -1550,14 +1550,13 @@ static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
>
> do {
> gl = ERR_PTR(rhashtable_walk_start(&iter));
Couldn't the rhashtable_walk_start() call be moved before the outer loop?
"* Returns -EAGAIN if resize event occured. Note that the iterator
* will rewind back to the beginning and you may use it immediately
* by calling rhashtable_walk_next."
so it looks like -EAGAIN doesn't require a stop and restart of the walk.
> - if (gl)
> - continue;
> -
> - while ((gl = rhashtable_walk_next(&iter)) && !IS_ERR(gl))
> - if ((gl->gl_name.ln_sbd == sdp) &&
> - lockref_get_not_dead(&gl->gl_lockref))
> - examiner(gl);
> -
> + if (!gl) {
This looks like it should be if (!IS_ERR(gl)) { ...
> + while ((gl = rhashtable_walk_next(&iter)) &&
> + !IS_ERR(gl))
> + if ((gl->gl_name.ln_sbd == sdp) &&
> + lockref_get_not_dead(&gl->gl_lockref))
> + examiner(gl);
> + }
> rhashtable_walk_stop(&iter);
See above.
Cheers,
Andy
> } while (cond_resched(), gl == ERR_PTR(-EAGAIN));
>
> @@ -1940,6 +1939,7 @@ static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
> }
>
> static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
> + __acquires(RCU)
> {
> struct gfs2_glock_iter *gi = seq->private;
> loff_t n = *pos;
> @@ -1972,6 +1972,7 @@ static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr,
> }
>
> static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
> + __releases(RCU)
> {
> struct gfs2_glock_iter *gi = seq->private;
>
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index 1d98b8a36eb3..65f33a0ac190 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -23,8 +23,6 @@
> #include "sys.h"
> #include "trace_gfs2.h"
>
> -extern struct workqueue_struct *gfs2_control_wq;
> -
> /**
> * gfs2_update_stats - Update time based stats
> * @mv: Pointer to mean/variance structure to update
> @@ -1176,7 +1174,7 @@ static void gdlm_recovery_result(struct gfs2_sbd *sdp, unsigned int jid,
> spin_unlock(&ls->ls_recover_spin);
> }
>
> -const struct dlm_lockspace_ops gdlm_lockspace_ops = {
> +static const struct dlm_lockspace_ops gdlm_lockspace_ops = {
> .recover_prep = gdlm_recover_prep,
> .recover_slot = gdlm_recover_slot,
> .recover_done = gdlm_recover_done,
> diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
> index 0a89e6f7a314..899329cfd733 100644
> --- a/fs/gfs2/main.c
> +++ b/fs/gfs2/main.c
> @@ -32,8 +32,6 @@
> #include "dir.h"
> #include "glops.h"
>
> -struct workqueue_struct *gfs2_control_wq;
> -
> static void gfs2_init_inode_once(void *foo)
> {
> struct gfs2_inode *ip = foo;
> diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> index c81295f407f6..3926f95a6eb7 100644
> --- a/fs/gfs2/util.h
> +++ b/fs/gfs2/util.h
> @@ -151,6 +151,7 @@ extern struct kmem_cache *gfs2_rgrpd_cachep;
> extern struct kmem_cache *gfs2_quotad_cachep;
> extern struct kmem_cache *gfs2_qadata_cachep;
> extern mempool_t *gfs2_page_pool;
> +extern struct workqueue_struct *gfs2_control_wq;
>
> static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
> unsigned int *p)
> diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
> index 54179554c7d2..cf694de4991a 100644
> --- a/fs/gfs2/xattr.c
> +++ b/fs/gfs2/xattr.c
> @@ -25,6 +25,7 @@
> #include "meta_io.h"
> #include "quota.h"
> #include "rgrp.h"
> +#include "super.h"
> #include "trans.h"
> #include "util.h"
>
>
next prev parent reply other threads:[~2017-08-18 15:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1809292291.1872363.1503065998850.JavaMail.zimbra@redhat.com>
2017-08-18 14:20 ` [Cluster-devel] [GFS2 PATCH] GFS2: Fix up some sparse warnings Bob Peterson
2017-08-18 15:52 ` Andrew Price [this message]
2017-08-22 19:54 ` Bob Peterson
2017-08-23 15:27 ` [Cluster-devel] [GFS2 PATCH] [v2] " Bob Peterson
2017-08-23 16:19 ` Andrew Price
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=20170818155159.GC12296@cicero \
--to=anprice@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).