ソースを参照

[GFS2] Fix ref count bug that used to bite us on umount

The ref count of certain glock's got elevated too far during unlink
which caused umount to fail. This fixes it.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Steven Whitehouse 19 年 前
コミット
64c14ea73b
1 ファイル変更6 行追加16 行削除
  1. 6 16
      fs/gfs2/inode.c

+ 6 - 16
fs/gfs2/inode.c

@@ -297,19 +297,13 @@ static int inode_create(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
 	if (!ip)
 	if (!ip)
 		return -ENOMEM;
 		return -ENOMEM;
 	memset(ip, 0, sizeof(struct gfs2_inode));
 	memset(ip, 0, sizeof(struct gfs2_inode));
-
 	ip->i_num = *inum;
 	ip->i_num = *inum;
-
 	atomic_set(&ip->i_count, 1);
 	atomic_set(&ip->i_count, 1);
-
 	ip->i_vn = i_gl->gl_vn - 1;
 	ip->i_vn = i_gl->gl_vn - 1;
-
 	ip->i_gl = i_gl;
 	ip->i_gl = i_gl;
 	ip->i_sbd = sdp;
 	ip->i_sbd = sdp;
-
 	spin_lock_init(&ip->i_spin);
 	spin_lock_init(&ip->i_spin);
 	init_rwsem(&ip->i_rw_mutex);
 	init_rwsem(&ip->i_rw_mutex);
-
 	ip->i_greedy = gfs2_tune_get(sdp, gt_greedy_default);
 	ip->i_greedy = gfs2_tune_get(sdp, gt_greedy_default);
 
 
 	if (need_lock) {
 	if (need_lock) {
@@ -318,27 +312,23 @@ static int inode_create(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
 					   &ip->i_iopen_gh);
 					   &ip->i_iopen_gh);
 		if (error)
 		if (error)
 			goto fail;
 			goto fail;
-	}
 
 
-	spin_lock(&io_gl->gl_spin);
-	gfs2_glock_hold(i_gl);
-	io_gl->gl_object = i_gl;
-	spin_unlock(&io_gl->gl_spin);
+		spin_lock(&io_gl->gl_spin);
+		gfs2_glock_hold(i_gl);
+		io_gl->gl_object = i_gl;
+		spin_unlock(&io_gl->gl_spin);
+	}
 
 
 	gfs2_glock_hold(i_gl);
 	gfs2_glock_hold(i_gl);
 	i_gl->gl_object = ip;
 	i_gl->gl_object = ip;
-
 	atomic_inc(&sdp->sd_inode_count);
 	atomic_inc(&sdp->sd_inode_count);
-
 	*ipp = ip;
 	*ipp = ip;
-
 	return 0;
 	return 0;
 
 
- fail:
+fail:
 	gfs2_meta_cache_flush(ip);
 	gfs2_meta_cache_flush(ip);
 	kmem_cache_free(gfs2_inode_cachep, ip);
 	kmem_cache_free(gfs2_inode_cachep, ip);
 	*ipp = NULL;
 	*ipp = NULL;
-
 	return error;
 	return error;
 }
 }