GFS2: Fix up some sparse warnings
authorBob Peterson <rpeterso@redhat.com>
Fri, 18 Aug 2017 14:15:13 +0000 (09:15 -0500)
committerBob Peterson <rpeterso@redhat.com>
Fri, 25 Aug 2017 23:47:18 +0000 (18:47 -0500)
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>
fs/gfs2/glock.c
fs/gfs2/lock_dlm.c
fs/gfs2/util.h
fs/gfs2/xattr.c

index ffca195985255f1409376aa2edfff538e4830fd3..4178417249c3ef9942c07d79a060f357c556e5e6 100644 (file)
@@ -1550,14 +1550,15 @@ static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
 
        do {
                gl = ERR_PTR(rhashtable_walk_start(&iter));
-               if (gl)
-                       continue;
+               if (IS_ERR(gl))
+                       goto walk_stop;
 
                while ((gl = rhashtable_walk_next(&iter)) && !IS_ERR(gl))
-                       if ((gl->gl_name.ln_sbd == sdp) &&
+                       if (gl->gl_name.ln_sbd == sdp &&
                            lockref_get_not_dead(&gl->gl_lockref))
                                examiner(gl);
 
+walk_stop:
                rhashtable_walk_stop(&iter);
        } while (cond_resched(), gl == ERR_PTR(-EAGAIN));
 
@@ -1940,6 +1941,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 +1974,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;
 
index 1d98b8a36eb39b1219d3f9521d17b1c3192f04a7..65f33a0ac190572fae58e7087431f3c2005824d5 100644 (file)
@@ -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,
index c81295f407f653aa0dc66bc5b0f609588d6cdd07..3926f95a6eb7070484131bb01117249f2f94094a 100644 (file)
@@ -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)
index 54179554c7d28b3800c95f4f9bb298650c387054..cf694de4991a1c047257dff93c16326e19cd3172 100644 (file)
@@ -25,6 +25,7 @@
 #include "meta_io.h"
 #include "quota.h"
 #include "rgrp.h"
+#include "super.h"
 #include "trans.h"
 #include "util.h"