Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes:
GFS2: Read resource groups on mount
GFS2: Ensure rindex is uptodate for fallocate
GFS2: Read in rindex if necessary during unlink
GFS2: Fix race between lru_list and glock ref count

+25 -12
+10 -4
fs/gfs2/glock.c
··· 167 167 spin_unlock(&lru_lock); 168 168 } 169 169 170 - static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) 170 + static void __gfs2_glock_remove_from_lru(struct gfs2_glock *gl) 171 171 { 172 - spin_lock(&lru_lock); 173 172 if (!list_empty(&gl->gl_lru)) { 174 173 list_del_init(&gl->gl_lru); 175 174 atomic_dec(&lru_count); 176 175 clear_bit(GLF_LRU, &gl->gl_flags); 177 176 } 177 + } 178 + 179 + static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) 180 + { 181 + spin_lock(&lru_lock); 182 + __gfs2_glock_remove_from_lru(gl); 178 183 spin_unlock(&lru_lock); 179 184 } 180 185 ··· 222 217 struct gfs2_sbd *sdp = gl->gl_sbd; 223 218 struct address_space *mapping = gfs2_glock2aspace(gl); 224 219 225 - if (atomic_dec_and_test(&gl->gl_ref)) { 220 + if (atomic_dec_and_lock(&gl->gl_ref, &lru_lock)) { 221 + __gfs2_glock_remove_from_lru(gl); 222 + spin_unlock(&lru_lock); 226 223 spin_lock_bucket(gl->gl_hash); 227 224 hlist_bl_del_rcu(&gl->gl_list); 228 225 spin_unlock_bucket(gl->gl_hash); 229 - gfs2_glock_remove_from_lru(gl); 230 226 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders)); 231 227 GLOCK_BUG_ON(gl, mapping && mapping->nrpages); 232 228 trace_gfs2_glock_put(gl);
+1 -4
fs/gfs2/inode.c
··· 391 391 int error; 392 392 int dblocks = 1; 393 393 394 - error = gfs2_rindex_update(sdp); 395 - if (error) 396 - fs_warn(sdp, "rindex update returns %d\n", error); 397 - 398 394 error = gfs2_inplace_reserve(dip, RES_DINODE); 399 395 if (error) 400 396 goto out; ··· 1039 1043 rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); 1040 1044 if (!rgd) 1041 1045 goto out_inodes; 1046 + 1042 1047 gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); 1043 1048 1044 1049
+5
fs/gfs2/ops_fstype.c
··· 800 800 fs_err(sdp, "can't get quota file inode: %d\n", error); 801 801 goto fail_rindex; 802 802 } 803 + 804 + error = gfs2_rindex_update(sdp); 805 + if (error) 806 + goto fail_qinode; 807 + 803 808 return 0; 804 809 805 810 fail_qinode:
+9 -4
fs/gfs2/rgrp.c
··· 683 683 struct gfs2_glock *gl = ip->i_gl; 684 684 struct gfs2_holder ri_gh; 685 685 int error = 0; 686 + int unlock_required = 0; 686 687 687 688 /* Read new copy from disk if we don't have the latest */ 688 689 if (!sdp->sd_rindex_uptodate) { 689 690 mutex_lock(&sdp->sd_rindex_mutex); 690 - error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh); 691 - if (error) 692 - return error; 691 + if (!gfs2_glock_is_locked_by_me(gl)) { 692 + error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh); 693 + if (error) 694 + return error; 695 + unlock_required = 1; 696 + } 693 697 if (!sdp->sd_rindex_uptodate) 694 698 error = gfs2_ri_update(ip); 695 - gfs2_glock_dq_uninit(&ri_gh); 699 + if (unlock_required) 700 + gfs2_glock_dq_uninit(&ri_gh); 696 701 mutex_unlock(&sdp->sd_rindex_mutex); 697 702 } 698 703