aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 559937c710fc..3d949187fed0 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1844,7 +1844,7 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
1844 1844
1845 spin_lock(&gl->gl_spin); 1845 spin_lock(&gl->gl_spin);
1846 1846
1847 print_dbg(gi, "Glock 0x%p (%u, %llu)\n", gl, gl->gl_name.ln_type, 1847 print_dbg(gi, "Glock 0x%p (%u, 0x%llx)\n", gl, gl->gl_name.ln_type,
1848 (unsigned long long)gl->gl_name.ln_number); 1848 (unsigned long long)gl->gl_name.ln_number);
1849 print_dbg(gi, " gl_flags ="); 1849 print_dbg(gi, " gl_flags =");
1850 for (x = 0; x < 32; x++) { 1850 for (x = 0; x < 32; x++) {
@@ -2024,20 +2024,21 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
2024{ 2024{
2025 struct gfs2_glock *gl; 2025 struct gfs2_glock *gl;
2026 2026
2027restart:
2027 read_lock(gl_lock_addr(gi->hash)); 2028 read_lock(gl_lock_addr(gi->hash));
2028 gl = gi->gl; 2029 gl = gi->gl;
2029 if (gl) { 2030 if (gl) {
2030 gi->gl = hlist_entry(gl->gl_list.next, struct gfs2_glock, 2031 gi->gl = hlist_entry(gl->gl_list.next,
2031 gl_list); 2032 struct gfs2_glock, gl_list);
2032 if (gi->gl) 2033 if (gi->gl)
2033 gfs2_glock_hold(gi->gl); 2034 gfs2_glock_hold(gi->gl);
2034 } 2035 }
2035 read_unlock(gl_lock_addr(gi->hash)); 2036 read_unlock(gl_lock_addr(gi->hash));
2036 if (gl) 2037 if (gl)
2037 gfs2_glock_put(gl); 2038 gfs2_glock_put(gl);
2038 2039 if (gl && gi->gl == NULL)
2039 while(gi->gl == NULL) {
2040 gi->hash++; 2040 gi->hash++;
2041 while(gi->gl == NULL) {
2041 if (gi->hash >= GFS2_GL_HASH_SIZE) 2042 if (gi->hash >= GFS2_GL_HASH_SIZE)
2042 return 1; 2043 return 1;
2043 read_lock(gl_lock_addr(gi->hash)); 2044 read_lock(gl_lock_addr(gi->hash));
@@ -2046,7 +2047,12 @@ static int gfs2_glock_iter_next(struct glock_iter *gi)
2046 if (gi->gl) 2047 if (gi->gl)
2047 gfs2_glock_hold(gi->gl); 2048 gfs2_glock_hold(gi->gl);
2048 read_unlock(gl_lock_addr(gi->hash)); 2049 read_unlock(gl_lock_addr(gi->hash));
2050 gi->hash++;
2049 } 2051 }
2052
2053 if (gi->sdp != gi->gl->gl_sbd)
2054 goto restart;
2055
2050 return 0; 2056 return 0;
2051} 2057}
2052 2058
@@ -2068,16 +2074,10 @@ static struct glock_iter *gfs2_glock_iter_init(struct gfs2_sbd *sdp)
2068 gi->sdp = sdp; 2074 gi->sdp = sdp;
2069 gi->hash = 0; 2075 gi->hash = 0;
2070 gi->seq = NULL; 2076 gi->seq = NULL;
2077 gi->gl = NULL;
2071 memset(gi->string, 0, sizeof(gi->string)); 2078 memset(gi->string, 0, sizeof(gi->string));
2072 2079
2073 read_lock(gl_lock_addr(gi->hash)); 2080 if (gfs2_glock_iter_next(gi)) {
2074 gi->gl = hlist_entry(gl_hash_table[gi->hash].hb_list.first,
2075 struct gfs2_glock, gl_list);
2076 if (gi->gl)
2077 gfs2_glock_hold(gi->gl);
2078 read_unlock(gl_lock_addr(gi->hash));
2079
2080 if (!gi->gl && gfs2_glock_iter_next(gi)) {
2081 gfs2_glock_iter_free(gi); 2081 gfs2_glock_iter_free(gi);
2082 return NULL; 2082 return NULL;
2083 } 2083 }