diff options
author | Robert Peterson <rpeterso@redhat.com> | 2007-04-17 12:37:11 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-05-01 04:11:28 -0400 |
commit | 7a0079d9e3fe8826475a08785f3d348c4b509774 (patch) | |
tree | 6b2d7e2b24989b8ad03b831e4fcaafcc3de00850 | |
parent | 8fa1de386f4d72f0710b389ccf96308fef87df78 (diff) |
[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>
-rw-r--r-- | fs/gfs2/glock.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index d2e3094c40f8..b075f9359c60 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, | |||
1765 | { | 1765 | { |
1766 | /* when sprint_symbol becomes available in the new kernel, replace this */ | 1766 | /* when sprint_symbol becomes available in the new kernel, replace this */ |
1767 | /* function with: | 1767 | /* function with: |
1768 | char buffer[KSYM_SYMBOL_LEN]; | 1768 | char buffer[KSYM_SYMBOL_LEN]; |
1769 | 1769 | ||
1770 | sprint_symbol(buffer, address); | 1770 | sprint_symbol(buffer, address); |
1771 | print_dbg(gi, fmt, buffer); | 1771 | print_dbg(gi, fmt, buffer); |
1772 | */ | 1772 | */ |
1773 | if (gi) | 1773 | char buffer[256]; |
1774 | print_dbg(gi, fmt, address); | 1774 | |
1775 | else | 1775 | if (gi) { |
1776 | print_symbol(fmt, address); | 1776 | memset(buffer, 0, sizeof(buffer)); |
1777 | sprintf(buffer, "%p", address); | ||
1778 | print_dbg(gi, fmt, buffer); | ||
1779 | } | ||
1780 | else | ||
1781 | print_symbol(fmt, address); | ||
1777 | } | 1782 | } |
1778 | 1783 | ||
1779 | /** | 1784 | /** |
@@ -1993,14 +1998,19 @@ int __init gfs2_glock_init(void) | |||
1993 | 1998 | ||
1994 | static int gfs2_glock_iter_next(struct glock_iter *gi) | 1999 | static int gfs2_glock_iter_next(struct glock_iter *gi) |
1995 | { | 2000 | { |
2001 | read_lock(gl_lock_addr(gi->hash)); | ||
1996 | while (1) { | 2002 | while (1) { |
1997 | if (!gi->hb_list) { /* If we don't have a hash bucket yet */ | 2003 | if (!gi->hb_list) { /* If we don't have a hash bucket yet */ |
1998 | gi->hb_list = &gl_hash_table[gi->hash].hb_list; | 2004 | gi->hb_list = &gl_hash_table[gi->hash].hb_list; |
1999 | if (hlist_empty(gi->hb_list)) { | 2005 | if (hlist_empty(gi->hb_list)) { |
2006 | read_unlock(gl_lock_addr(gi->hash)); | ||
2000 | gi->hash++; | 2007 | gi->hash++; |
2008 | read_lock(gl_lock_addr(gi->hash)); | ||
2001 | gi->hb_list = NULL; | 2009 | gi->hb_list = NULL; |
2002 | if (gi->hash >= GFS2_GL_HASH_SIZE) | 2010 | if (gi->hash >= GFS2_GL_HASH_SIZE) { |
2011 | read_unlock(gl_lock_addr(gi->hash)); | ||
2003 | return 1; | 2012 | return 1; |
2013 | } | ||
2004 | else | 2014 | else |
2005 | continue; | 2015 | continue; |
2006 | } | 2016 | } |
@@ -2011,7 +2021,9 @@ static int gfs2_glock_iter_next(struct glock_iter *gi) | |||
2011 | } | 2021 | } |
2012 | } else { | 2022 | } else { |
2013 | if (gi->gl->gl_list.next == NULL) { | 2023 | if (gi->gl->gl_list.next == NULL) { |
2024 | read_unlock(gl_lock_addr(gi->hash)); | ||
2014 | gi->hash++; | 2025 | gi->hash++; |
2026 | read_lock(gl_lock_addr(gi->hash)); | ||
2015 | gi->hb_list = NULL; | 2027 | gi->hb_list = NULL; |
2016 | continue; | 2028 | continue; |
2017 | } | 2029 | } |
@@ -2021,6 +2033,7 @@ static int gfs2_glock_iter_next(struct glock_iter *gi) | |||
2021 | if (gi->gl) | 2033 | if (gi->gl) |
2022 | break; | 2034 | break; |
2023 | } | 2035 | } |
2036 | read_unlock(gl_lock_addr(gi->hash)); | ||
2024 | return 0; | 2037 | return 0; |
2025 | } | 2038 | } |
2026 | 2039 | ||