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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Whitehouse
Date: Tuesday, May 1, 2007 - 3:18 am

>From 7a0079d9e3fe8826475a08785f3d348c4b509774 Mon Sep 17 00:00:00 2001
From: Robert Peterson <rpeterso@redhat.com>
Date: Tue, 17 Apr 2007 11:37:11 -0500
Subject: [PATCH] [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>

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index d2e3094..b075f93 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -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 */
 /* function with:
-        char buffer[KSYM_SYMBOL_LEN];
+	char buffer[KSYM_SYMBOL_LEN];
 
-        sprint_symbol(buffer, address);
-        print_dbg(gi, fmt, buffer);
+	sprint_symbol(buffer, address);
+	print_dbg(gi, fmt, buffer);
 */
-        if (gi)
-                print_dbg(gi, fmt, address);
-        else
-                print_symbol(fmt, address);
+	char buffer[256];
+
+	if (gi) {
+		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)
 {
+	read_lock(gl_lock_addr(gi->hash));
 	while (1) {
 		if (!gi->hb_list) {  /* If we don't have a hash bucket yet */
 			gi->hb_list = &gl_hash_table[gi->hash].hb_list;
 			if (hlist_empty(gi->hb_list)) {
+				read_unlock(gl_lock_addr(gi->hash));
 				gi->hash++;
+				read_lock(gl_lock_addr(gi->hash));
 				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;
+				}
 				else
 					continue;
 			}
@@ -2011,7 +2021,9 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
 			}
 		} else {
 			if (gi->gl->gl_list.next == NULL) {
+				read_unlock(gl_lock_addr(gi->hash));
 				gi->hash++;
+				read_lock(gl_lock_addr(gi->hash));
 				gi->hb_list = NULL;
 				continue;
 			}
@@ -2021,6 +2033,7 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
 		if (gi->gl)
 			break;
 	}
+	read_unlock(gl_lock_addr(gi->hash));
 	return 0;
 }
 
-- 
1.5.1.2



-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GFS2] Patches for the current merge window [0/34], Steven Whitehouse, (Tue May 1, 2:56 am)
[DLM] Fix uninitialised variable in receiving [3/34], Steven Whitehouse, (Tue May 1, 2:59 am)
[GFS2] Fix bz 224480 and cleanup glock demotion code [5/34], Steven Whitehouse, (Tue May 1, 3:02 am)
[GFS2] Fix a bug on i386 due to evaluation order [6/34], Steven Whitehouse, (Tue May 1, 3:02 am)
[DLM] Don't delete misc device if lockspace removal fails ..., Steven Whitehouse, (Tue May 1, 3:03 am)
[GFS2] Speed up lock_dlm's locking (move sprintf) [8/34], Steven Whitehouse, (Tue May 1, 3:04 am)
[GFS2] Fix log entry list corruption [9/34], Steven Whitehouse, (Tue May 1, 3:05 am)
[GFS2] Red Hat bz 228540: owner references [11/34], Steven Whitehouse, (Tue May 1, 3:07 am)
[DLM] fix coverity-spotted stupidity [12/34], Steven Whitehouse, (Tue May 1, 3:07 am)
[DLM] overlapping cancel and unlock [13/34], Steven Whitehouse, (Tue May 1, 3:09 am)
[GFS2] use log_error before LM_OUT_ERROR [14/34], Steven Whitehouse, (Tue May 1, 3:09 am)
[GFS2] Set drop_count to 0 (off) by default [15/34], Steven Whitehouse, (Tue May 1, 3:10 am)
[DLM] split create_message function [16/34], Steven Whitehouse, (Tue May 1, 3:11 am)
[DLM] add orphan purging code (1/2) [17/34], Steven Whitehouse, (Tue May 1, 3:12 am)
[DLM] interface for purge (2/2) [18/34], Steven Whitehouse, (Tue May 1, 3:12 am)
[DLM] change lkid format [19/34], Steven Whitehouse, (Tue May 1, 3:13 am)
[DLM] change lkid format [19/34], Steven Whitehouse, (Tue May 1, 3:14 am)
GFS2] Fix bz 234168 (ignoring rgrp flags) [20/34], Steven Whitehouse, (Tue May 1, 3:14 am)
[DLM] Remove redundant assignment [21/34], Steven Whitehouse, (Tue May 1, 3:15 am)
[DLM] Consolidate transport protocols [21/34], Steven Whitehouse, (Tue May 1, 3:16 am)
DLM] fs/dlm/ast.c should #include &quot;ast.h&quot; [23/34], Steven Whitehouse, (Tue May 1, 3:17 am)
[GFS2] bz 236008: Kernel gpf doing cat /debugfs/gfs2/xxx ( ..., Steven Whitehouse, (Tue May 1, 3:18 am)
[GFS2] lockdump improvements [26/34], Steven Whitehouse, (Tue May 1, 3:20 am)
[DLM] fix mode munging [27/34], Steven Whitehouse, (Tue May 1, 3:20 am)
[DLM] Fix dlm_lowcoms_stop hang [28/34], Steven Whitehouse, (Tue May 1, 3:21 am)
[GFS2] use lib/parser for parsing mount options [30/34], Steven Whitehouse, (Tue May 1, 3:22 am)
[GFS2] Patch to fix mmap of stuffed files [31/34], Steven Whitehouse, (Tue May 1, 3:23 am)
[GFS2] printk warning fixes [32/34], Steven Whitehouse, (Tue May 1, 3:24 am)
[DLM] lowcomms style [33/34], Steven Whitehouse, (Tue May 1, 3:24 am)
[GFS2] Uncomment sprintf_symbol calling code [34/34], Steven Whitehouse, (Tue May 1, 3:25 am)
[GFS2/DLM] Pull request, Steven Whitehouse, (Tue May 1, 7:11 am)