]> err.no Git - linux-2.6/blobdiff - fs/gfs2/glock.c
Merge branch 'server-cluster-locking-api' of git://linux-nfs.org/~bfields/linux
[linux-2.6] / fs / gfs2 / glock.c
index d2e3094c40f8614123e7aa1f2d19500efa0b17c7..1815429a29789c7c507752cbb1be118b9954c832 100644 (file)
@@ -1763,17 +1763,10 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp, int wait)
 static void gfs2_print_symbol(struct glock_iter *gi, const char *fmt,
                               unsigned long address)
 {
-/* 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);
-*/
-        if (gi)
-                print_dbg(gi, fmt, address);
-        else
-                print_symbol(fmt, address);
+       sprint_symbol(buffer, address);
+       print_dbg(gi, fmt, buffer);
 }
 
 /**
@@ -1993,14 +1986,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 +2009,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 +2021,7 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
                if (gi->gl)
                        break;
        }
+       read_unlock(gl_lock_addr(gi->hash));
        return 0;
 }
 
@@ -2133,11 +2134,14 @@ static const struct file_operations gfs2_debug_fops = {
 
 int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
 {
-       sdp->debugfs_dentry = debugfs_create_file(sdp->sd_table_name,
-                                                 S_IFREG | S_IRUGO,
-                                                 gfs2_root, sdp,
-                                                 &gfs2_debug_fops);
-       if (!sdp->debugfs_dentry)
+       sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
+       if (!sdp->debugfs_dir)
+               return -ENOMEM;
+       sdp->debugfs_dentry_glocks = debugfs_create_file("glocks",
+                                                        S_IFREG | S_IRUGO,
+                                                        sdp->debugfs_dir, sdp,
+                                                        &gfs2_debug_fops);
+       if (!sdp->debugfs_dentry_glocks)
                return -ENOMEM;
 
        return 0;
@@ -2145,8 +2149,14 @@ int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
 
 void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
 {
-       if (sdp && sdp->debugfs_dentry)
-               debugfs_remove(sdp->debugfs_dentry);
+       if (sdp && sdp->debugfs_dir) {
+               if (sdp->debugfs_dentry_glocks) {
+                       debugfs_remove(sdp->debugfs_dentry_glocks);
+                       sdp->debugfs_dentry_glocks = NULL;
+               }
+               debugfs_remove(sdp->debugfs_dir);
+               sdp->debugfs_dir = NULL;
+       }
 }
 
 int gfs2_register_debugfs(void)
@@ -2158,4 +2168,5 @@ int gfs2_register_debugfs(void)
 void gfs2_unregister_debugfs(void)
 {
        debugfs_remove(gfs2_root);
+       gfs2_root = NULL;
 }