Skip to content

Commit

Permalink
GFS2: Fix debugfs glock file iterator
Browse files Browse the repository at this point in the history
Due to an incorrect iterator, some glocks were being missed from the
glock dumps obtained via debugfs. This patch fixes the problem and
ensures that we don't miss any glocks in future.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Aug 13, 2008
1 parent 30a2f3c commit c1e817d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,15 +1816,17 @@ static int gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
if (gl) {
gi->gl = hlist_entry(gl->gl_list.next,
struct gfs2_glock, gl_list);
if (gi->gl)
gfs2_glock_hold(gi->gl);
} else {
gi->gl = hlist_entry(gl_hash_table[gi->hash].hb_list.first,
struct gfs2_glock, gl_list);
}
if (gi->gl)
gfs2_glock_hold(gi->gl);
read_unlock(gl_lock_addr(gi->hash));
if (gl)
gfs2_glock_put(gl);
if (gl && gi->gl == NULL)
gi->hash++;
while (gi->gl == NULL) {
gi->hash++;
if (gi->hash >= GFS2_GL_HASH_SIZE)
return 1;
read_lock(gl_lock_addr(gi->hash));
Expand All @@ -1833,7 +1835,6 @@ static int gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
if (gi->gl)
gfs2_glock_hold(gi->gl);
read_unlock(gl_lock_addr(gi->hash));
gi->hash++;
}

if (gi->sdp != gi->gl->gl_sbd)
Expand Down

0 comments on commit c1e817d

Please sign in to comment.