Browse Source

[GFS2] Fixes to scanning of glocks (again)

This really is the correct fix this time. We just ignore all
glocks associated with inodes until the inodes are pushed
from the inode cache. At that point the glocks are queued for
reclaim, so we don't need to do it here.

Also fix one or two other minor bugs.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Steven Whitehouse 19 years ago
parent
commit
29937ac6ca
4 changed files with 7 additions and 11 deletions
  1. 3 9
      fs/gfs2/glock.c
  2. 2 0
      fs/gfs2/inode.c
  3. 1 0
      fs/gfs2/ops_inode.c
  4. 1 2
      fs/gfs2/page.c

+ 3 - 9
fs/gfs2/glock.c

@@ -1965,19 +1965,13 @@ static int examine_bucket(glock_examiner examiner, struct gfs2_sbd *sdp,
 static void scan_glock(struct gfs2_glock *gl)
 static void scan_glock(struct gfs2_glock *gl)
 {
 {
 	if (gfs2_glmutex_trylock(gl)) {
 	if (gfs2_glmutex_trylock(gl)) {
-		if (gl->gl_ops == &gfs2_inode_glops) {
-			struct gfs2_inode *ip = gl->gl_object;
-			if (ip == NULL) {
-				struct gfs2_sbd *sdp = gl->gl_sbd;
-				gfs2_assert_withdraw(sdp, gl->gl_state == LM_ST_UNLOCKED);
-				goto out_schedule;
-			}
-		}
+		if (gl->gl_ops == &gfs2_inode_glops)
+			goto out;
 		if (queue_empty(gl, &gl->gl_holders) &&
 		if (queue_empty(gl, &gl->gl_holders) &&
 		    gl->gl_state != LM_ST_UNLOCKED &&
 		    gl->gl_state != LM_ST_UNLOCKED &&
 		    demote_ok(gl))
 		    demote_ok(gl))
 			goto out_schedule;
 			goto out_schedule;
-
+out:
 		gfs2_glmutex_unlock(gl);
 		gfs2_glmutex_unlock(gl);
 	}
 	}
 
 

+ 2 - 0
fs/gfs2/inode.c

@@ -325,6 +325,7 @@ int gfs2_change_nlink(struct gfs2_inode *ip, int diff)
 	uint32_t nlink;
 	uint32_t nlink;
 	int error;
 	int error;
 
 
+	BUG_ON(ip->i_di.di_nlink != ip->i_inode.i_nlink);
 	nlink = ip->i_di.di_nlink + diff;
 	nlink = ip->i_di.di_nlink + diff;
 
 
 	/* If we are reducing the nlink count, but the new value ends up being
 	/* If we are reducing the nlink count, but the new value ends up being
@@ -341,6 +342,7 @@ int gfs2_change_nlink(struct gfs2_inode *ip, int diff)
 
 
 	ip->i_di.di_nlink = nlink;
 	ip->i_di.di_nlink = nlink;
 	ip->i_di.di_ctime = get_seconds();
 	ip->i_di.di_ctime = get_seconds();
+	ip->i_inode.i_nlink = nlink;
 
 
 	gfs2_trans_add_bh(ip->i_gl, dibh, 1);
 	gfs2_trans_add_bh(ip->i_gl, dibh, 1);
 	gfs2_dinode_out(&ip->i_di, dibh->b_data);
 	gfs2_dinode_out(&ip->i_di, dibh->b_data);

+ 1 - 0
fs/gfs2/ops_inode.c

@@ -250,6 +250,7 @@ out:
 	gfs2_holder_uninit(ghs + 1);
 	gfs2_holder_uninit(ghs + 1);
 
 
 	if (!error) {
 	if (!error) {
+		atomic_inc(&inode->i_count);
 		d_instantiate(dentry, inode);
 		d_instantiate(dentry, inode);
 		mark_inode_dirty(inode);
 		mark_inode_dirty(inode);
 	}
 	}

+ 1 - 2
fs/gfs2/page.c

@@ -256,8 +256,7 @@ void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
 	struct buffer_head *bh;
 	struct buffer_head *bh;
 	unsigned int start, end;
 	unsigned int start, end;
 
 
-	for (bh = head, start = 0;
-	     bh != head || !start;
+	for (bh = head, start = 0; bh != head || !start;
 	     bh = bh->b_this_page, start = end) {
 	     bh = bh->b_this_page, start = end) {
 		end = start + bsize;
 		end = start + bsize;
 		if (end <= from || start >= to)
 		if (end <= from || start >= to)