[GFS2] bz 236008: Kernel gpf doing cat /debugfs/gfs2/xxx (lock dump)

This is for Bugzilla Bug 236008: Kernel gpf doing cat /debugfs/gfs2/xxx
(lock dump) seen at the "gfs2 summit".  This also fixes the bug that caused
garbage to be printed by the "initialized at" field.  I apologize for the
kludge, but that code will all be ripped out anyway when the official
sprint_symbol function becomes available in the Linux kernel.  I also
changed some formatting so that spaces are replaced by proper tabs.

Signed-off-by: Robert Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
Robert Peterson 2007-04-17 11:37:11 -05:00 committed by Steven Whitehouse
parent 8fa1de386f
commit 7a0079d9e3
1 changed files with 21 additions and 8 deletions

View File

@ -1765,15 +1765,20 @@ static void gfs2_print_symbol(struct glock_iter *gi, const char *fmt,
{ {
/* when sprint_symbol becomes available in the new kernel, replace this */ /* when sprint_symbol becomes available in the new kernel, replace this */
/* function with: /* function with:
char buffer[KSYM_SYMBOL_LEN]; char buffer[KSYM_SYMBOL_LEN];
sprint_symbol(buffer, address); sprint_symbol(buffer, address);
print_dbg(gi, fmt, buffer); print_dbg(gi, fmt, buffer);
*/ */
if (gi) char buffer[256];
print_dbg(gi, fmt, address);
else if (gi) {
print_symbol(fmt, address); memset(buffer, 0, sizeof(buffer));
sprintf(buffer, "%p", address);
print_dbg(gi, fmt, buffer);
}
else
print_symbol(fmt, address);
} }
/** /**
@ -1993,14 +1998,19 @@ int __init gfs2_glock_init(void)
static int gfs2_glock_iter_next(struct glock_iter *gi) static int gfs2_glock_iter_next(struct glock_iter *gi)
{ {
read_lock(gl_lock_addr(gi->hash));
while (1) { while (1) {
if (!gi->hb_list) { /* If we don't have a hash bucket yet */ if (!gi->hb_list) { /* If we don't have a hash bucket yet */
gi->hb_list = &gl_hash_table[gi->hash].hb_list; gi->hb_list = &gl_hash_table[gi->hash].hb_list;
if (hlist_empty(gi->hb_list)) { if (hlist_empty(gi->hb_list)) {
read_unlock(gl_lock_addr(gi->hash));
gi->hash++; gi->hash++;
read_lock(gl_lock_addr(gi->hash));
gi->hb_list = NULL; gi->hb_list = NULL;
if (gi->hash >= GFS2_GL_HASH_SIZE) if (gi->hash >= GFS2_GL_HASH_SIZE) {
read_unlock(gl_lock_addr(gi->hash));
return 1; return 1;
}
else else
continue; continue;
} }
@ -2011,7 +2021,9 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
} }
} else { } else {
if (gi->gl->gl_list.next == NULL) { if (gi->gl->gl_list.next == NULL) {
read_unlock(gl_lock_addr(gi->hash));
gi->hash++; gi->hash++;
read_lock(gl_lock_addr(gi->hash));
gi->hb_list = NULL; gi->hb_list = NULL;
continue; continue;
} }
@ -2021,6 +2033,7 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
if (gi->gl) if (gi->gl)
break; break;
} }
read_unlock(gl_lock_addr(gi->hash));
return 0; return 0;
} }