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

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
GFS2: Use DEFINE_SPINLOCK
GFS2: cleanup file_operations mess
GFS2: Move umount flush rwsem
GFS2: Fix symlink creation race
GFS2: Make quotad's waiting interruptible

+24 -21
+5 -5
fs/gfs2/glock.c
··· 597 598 GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)); 599 600 - down_read(&gfs2_umount_flush_sem); 601 if (test_bit(GLF_DEMOTE, &gl->gl_flags) && 602 gl->gl_demote_state != gl->gl_state) { 603 if (find_first_holder(gl)) ··· 613 if (ret == 0) 614 goto out_unlock; 615 if (ret == 2) 616 - goto out_sem; 617 gh = find_first_waiter(gl); 618 gl->gl_target = gh->gh_state; 619 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) 620 do_error(gl, 0); /* Fail queued try locks */ 621 } 622 do_xmote(gl, gh, gl->gl_target); 623 - out_sem: 624 - up_read(&gfs2_umount_flush_sem); 625 return; 626 627 out_sched: ··· 629 gfs2_glock_put(gl); 630 out_unlock: 631 clear_bit(GLF_LOCK, &gl->gl_flags); 632 - goto out_sem; 633 } 634 635 static void glock_work_func(struct work_struct *work) ··· 639 640 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) 641 finish_xmote(gl, gl->gl_reply); 642 spin_lock(&gl->gl_spin); 643 if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && 644 gl->gl_state != LM_ST_UNLOCKED && ··· 652 } 653 run_queue(gl, 0); 654 spin_unlock(&gl->gl_spin); 655 if (!delay || 656 queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) 657 gfs2_glock_put(gl);
··· 597 598 GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)); 599 600 if (test_bit(GLF_DEMOTE, &gl->gl_flags) && 601 gl->gl_demote_state != gl->gl_state) { 602 if (find_first_holder(gl)) ··· 614 if (ret == 0) 615 goto out_unlock; 616 if (ret == 2) 617 + goto out; 618 gh = find_first_waiter(gl); 619 gl->gl_target = gh->gh_state; 620 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) 621 do_error(gl, 0); /* Fail queued try locks */ 622 } 623 do_xmote(gl, gh, gl->gl_target); 624 + out: 625 return; 626 627 out_sched: ··· 631 gfs2_glock_put(gl); 632 out_unlock: 633 clear_bit(GLF_LOCK, &gl->gl_flags); 634 + goto out; 635 } 636 637 static void glock_work_func(struct work_struct *work) ··· 641 642 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) 643 finish_xmote(gl, gl->gl_reply); 644 + down_read(&gfs2_umount_flush_sem); 645 spin_lock(&gl->gl_spin); 646 if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && 647 gl->gl_state != LM_ST_UNLOCKED && ··· 653 } 654 run_queue(gl, 0); 655 spin_unlock(&gl->gl_spin); 656 + up_read(&gfs2_umount_flush_sem); 657 if (!delay || 658 queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) 659 gfs2_glock_put(gl);
+4 -4
fs/gfs2/inode.c
··· 137 if (S_ISREG(mode)) { 138 inode->i_op = &gfs2_file_iops; 139 if (gfs2_localflocks(sdp)) 140 - inode->i_fop = gfs2_file_fops_nolock; 141 else 142 - inode->i_fop = gfs2_file_fops; 143 } else if (S_ISDIR(mode)) { 144 inode->i_op = &gfs2_dir_iops; 145 if (gfs2_localflocks(sdp)) 146 - inode->i_fop = gfs2_dir_fops_nolock; 147 else 148 - inode->i_fop = gfs2_dir_fops; 149 } else if (S_ISLNK(mode)) { 150 inode->i_op = &gfs2_symlink_iops; 151 } else {
··· 137 if (S_ISREG(mode)) { 138 inode->i_op = &gfs2_file_iops; 139 if (gfs2_localflocks(sdp)) 140 + inode->i_fop = &gfs2_file_fops_nolock; 141 else 142 + inode->i_fop = &gfs2_file_fops; 143 } else if (S_ISDIR(mode)) { 144 inode->i_op = &gfs2_dir_iops; 145 if (gfs2_localflocks(sdp)) 146 + inode->i_fop = &gfs2_dir_fops_nolock; 147 else 148 + inode->i_fop = &gfs2_dir_fops; 149 } else if (S_ISLNK(mode)) { 150 inode->i_op = &gfs2_symlink_iops; 151 } else {
+8 -6
fs/gfs2/inode.h
··· 101 extern const struct inode_operations gfs2_file_iops; 102 extern const struct inode_operations gfs2_dir_iops; 103 extern const struct inode_operations gfs2_symlink_iops; 104 - extern const struct file_operations *gfs2_file_fops_nolock; 105 - extern const struct file_operations *gfs2_dir_fops_nolock; 106 107 extern void gfs2_set_inode_flags(struct inode *inode); 108 109 #ifdef CONFIG_GFS2_FS_LOCKING_DLM 110 - extern const struct file_operations *gfs2_file_fops; 111 - extern const struct file_operations *gfs2_dir_fops; 112 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) 113 { 114 return sdp->sd_args.ar_localflocks; 115 } 116 #else /* Single node only */ 117 - #define gfs2_file_fops NULL 118 - #define gfs2_dir_fops NULL 119 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) 120 { 121 return 1;
··· 101 extern const struct inode_operations gfs2_file_iops; 102 extern const struct inode_operations gfs2_dir_iops; 103 extern const struct inode_operations gfs2_symlink_iops; 104 + extern const struct file_operations gfs2_file_fops_nolock; 105 + extern const struct file_operations gfs2_dir_fops_nolock; 106 107 extern void gfs2_set_inode_flags(struct inode *inode); 108 109 #ifdef CONFIG_GFS2_FS_LOCKING_DLM 110 + extern const struct file_operations gfs2_file_fops; 111 + extern const struct file_operations gfs2_dir_fops; 112 + 113 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) 114 { 115 return sdp->sd_args.ar_localflocks; 116 } 117 #else /* Single node only */ 118 + #define gfs2_file_fops gfs2_file_fops_nolock 119 + #define gfs2_dir_fops gfs2_dir_fops_nolock 120 + 121 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) 122 { 123 return 1;
+4 -4
fs/gfs2/ops_file.c
··· 705 } 706 } 707 708 - const struct file_operations *gfs2_file_fops = &(const struct file_operations){ 709 .llseek = gfs2_llseek, 710 .read = do_sync_read, 711 .aio_read = generic_file_aio_read, ··· 723 .setlease = gfs2_setlease, 724 }; 725 726 - const struct file_operations *gfs2_dir_fops = &(const struct file_operations){ 727 .readdir = gfs2_readdir, 728 .unlocked_ioctl = gfs2_ioctl, 729 .open = gfs2_open, ··· 735 736 #endif /* CONFIG_GFS2_FS_LOCKING_DLM */ 737 738 - const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operations){ 739 .llseek = gfs2_llseek, 740 .read = do_sync_read, 741 .aio_read = generic_file_aio_read, ··· 751 .setlease = generic_setlease, 752 }; 753 754 - const struct file_operations *gfs2_dir_fops_nolock = &(const struct file_operations){ 755 .readdir = gfs2_readdir, 756 .unlocked_ioctl = gfs2_ioctl, 757 .open = gfs2_open,
··· 705 } 706 } 707 708 + const struct file_operations gfs2_file_fops = { 709 .llseek = gfs2_llseek, 710 .read = do_sync_read, 711 .aio_read = generic_file_aio_read, ··· 723 .setlease = gfs2_setlease, 724 }; 725 726 + const struct file_operations gfs2_dir_fops = { 727 .readdir = gfs2_readdir, 728 .unlocked_ioctl = gfs2_ioctl, 729 .open = gfs2_open, ··· 735 736 #endif /* CONFIG_GFS2_FS_LOCKING_DLM */ 737 738 + const struct file_operations gfs2_file_fops_nolock = { 739 .llseek = gfs2_llseek, 740 .read = do_sync_read, 741 .aio_read = generic_file_aio_read, ··· 751 .setlease = generic_setlease, 752 }; 753 754 + const struct file_operations gfs2_dir_fops_nolock = { 755 .readdir = gfs2_readdir, 756 .unlocked_ioctl = gfs2_ioctl, 757 .open = gfs2_open,
+1
fs/gfs2/ops_inode.c
··· 371 ip = ghs[1].gh_gl->gl_object; 372 373 ip->i_disksize = size; 374 375 error = gfs2_meta_inode_buffer(ip, &dibh); 376
··· 371 ip = ghs[1].gh_gl->gl_object; 372 373 ip->i_disksize = size; 374 + i_size_write(inode, size); 375 376 error = gfs2_meta_inode_buffer(ip, &dibh); 377
+2 -2
fs/gfs2/quota.c
··· 81 82 static LIST_HEAD(qd_lru_list); 83 static atomic_t qd_lru_count = ATOMIC_INIT(0); 84 - static spinlock_t qd_lru_lock = SPIN_LOCK_UNLOCKED; 85 86 int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask) 87 { ··· 1364 refrigerator(); 1365 t = min(quotad_timeo, statfs_timeo); 1366 1367 - prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_UNINTERRUPTIBLE); 1368 spin_lock(&sdp->sd_trunc_lock); 1369 empty = list_empty(&sdp->sd_trunc_list); 1370 spin_unlock(&sdp->sd_trunc_lock);
··· 81 82 static LIST_HEAD(qd_lru_list); 83 static atomic_t qd_lru_count = ATOMIC_INIT(0); 84 + static DEFINE_SPINLOCK(qd_lru_lock); 85 86 int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask) 87 { ··· 1364 refrigerator(); 1365 t = min(quotad_timeo, statfs_timeo); 1366 1367 + prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_INTERRUPTIBLE); 1368 spin_lock(&sdp->sd_trunc_lock); 1369 empty = list_empty(&sdp->sd_trunc_list); 1370 spin_unlock(&sdp->sd_trunc_lock);