]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
gfs2: Fix debugfs glocks dump
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 19 Sep 2017 12:15:35 +0000 (07:15 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 12 Oct 2017 21:20:34 +0000 (16:20 -0500)
BugLink: http://bugs.launchpad.net/bugs/1721777
commit 10201655b085df8e000822e496e5d4016a167a36 upstream.

The switch to rhashtables (commit 88ffbf3e03) broke the debugfs glock
dump (/sys/kernel/debug/gfs2/<device>/glocks) for dumps bigger than a
single buffer: the right function for restarting an rhashtable iteration
from the beginning of the hash table is rhashtable_walk_enter;
rhashtable_walk_stop + rhashtable_walk_start will just resume from the
current position.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/gfs2/glock.c

index c38ab6c818983803d67815ac4a32b9302e48795d..410714c9eff7adfc2d7468e2b67aca95cd5ea153 100644 (file)
@@ -1863,13 +1863,9 @@ static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
 {
        struct gfs2_glock_iter *gi = seq->private;
        loff_t n = *pos;
-       int ret;
-
-       if (gi->last_pos <= *pos)
-               n = (*pos - gi->last_pos);
 
-       ret = rhashtable_walk_start(&gi->hti);
-       if (ret)
+       rhashtable_walk_enter(&gl_hash_table, &gi->hti);
+       if (rhashtable_walk_start(&gi->hti) != 0)
                return NULL;
 
        do {
@@ -1877,6 +1873,7 @@ static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
        } while (gi->gl && n--);
 
        gi->last_pos = *pos;
+
        return gi->gl;
 }
 
@@ -1888,6 +1885,7 @@ static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr,
        (*pos)++;
        gi->last_pos = *pos;
        gfs2_glock_iter_next(gi);
+
        return gi->gl;
 }
 
@@ -1897,6 +1895,7 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
 
        gi->gl = NULL;
        rhashtable_walk_stop(&gi->hti);
+       rhashtable_walk_exit(&gi->hti);
 }
 
 static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
@@ -1959,12 +1958,10 @@ static int __gfs2_glocks_open(struct inode *inode, struct file *file,
                struct gfs2_glock_iter *gi = seq->private;
 
                gi->sdp = inode->i_private;
-               gi->last_pos = 0;
                seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
                if (seq->buf)
                        seq->size = GFS2_SEQ_GOODSIZE;
                gi->gl = NULL;
-               rhashtable_walk_enter(&gl_hash_table, &gi->hti);
        }
        return ret;
 }
@@ -1980,7 +1977,6 @@ static int gfs2_glocks_release(struct inode *inode, struct file *file)
        struct gfs2_glock_iter *gi = seq->private;
 
        gi->gl = NULL;
-       rhashtable_walk_exit(&gi->hti);
        return seq_release_private(inode, file);
 }