All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] GFS2: bz 236008: Kernel gpf doing cat /debugfs/gfs2/xxx (lock dump)
Date: Mon, 16 Apr 2007 10:01:59 -0500	[thread overview]
Message-ID: <46238FE7.3000102@redhat.com> (raw)

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: Bob Peterson (rpeterso at redhat.com)

 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 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;
 }
 



                 reply	other threads:[~2007-04-16 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46238FE7.3000102@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.