diff options
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index c282ad41f3d1..50aac606b990 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
22 | #include <linux/crc32.h> | 22 | #include <linux/crc32.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/wait.h> | ||
25 | #include <linux/writeback.h> | ||
24 | 26 | ||
25 | #include "gfs2.h" | 27 | #include "gfs2.h" |
26 | #include "incore.h" | 28 | #include "incore.h" |
@@ -710,7 +712,7 @@ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp) | |||
710 | * Returns: errno | 712 | * Returns: errno |
711 | */ | 713 | */ |
712 | 714 | ||
713 | static int gfs2_write_inode(struct inode *inode, int sync) | 715 | static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc) |
714 | { | 716 | { |
715 | struct gfs2_inode *ip = GFS2_I(inode); | 717 | struct gfs2_inode *ip = GFS2_I(inode); |
716 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 718 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -721,8 +723,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
721 | int ret = 0; | 723 | int ret = 0; |
722 | 724 | ||
723 | /* Check this is a "normal" inode, etc */ | 725 | /* Check this is a "normal" inode, etc */ |
724 | if (!test_bit(GIF_USER, &ip->i_flags) || | 726 | if (current->flags & PF_MEMALLOC) |
725 | (current->flags & PF_MEMALLOC)) | ||
726 | return 0; | 727 | return 0; |
727 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 728 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
728 | if (ret) | 729 | if (ret) |
@@ -745,7 +746,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
745 | do_unlock: | 746 | do_unlock: |
746 | gfs2_glock_dq_uninit(&gh); | 747 | gfs2_glock_dq_uninit(&gh); |
747 | do_flush: | 748 | do_flush: |
748 | if (sync != 0) | 749 | if (wbc->sync_mode == WB_SYNC_ALL) |
749 | gfs2_log_flush(GFS2_SB(inode), ip->i_gl); | 750 | gfs2_log_flush(GFS2_SB(inode), ip->i_gl); |
750 | return ret; | 751 | return ret; |
751 | } | 752 | } |
@@ -763,7 +764,7 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) | |||
763 | int error; | 764 | int error; |
764 | 765 | ||
765 | flush_workqueue(gfs2_delete_workqueue); | 766 | flush_workqueue(gfs2_delete_workqueue); |
766 | gfs2_quota_sync(sdp->sd_vfs, 0); | 767 | gfs2_quota_sync(sdp->sd_vfs, 0, 1); |
767 | gfs2_statfs_sync(sdp->sd_vfs, 0); | 768 | gfs2_statfs_sync(sdp->sd_vfs, 0); |
768 | 769 | ||
769 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, | 770 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, |
@@ -859,6 +860,7 @@ restart: | |||
859 | gfs2_clear_rgrpd(sdp); | 860 | gfs2_clear_rgrpd(sdp); |
860 | gfs2_jindex_free(sdp); | 861 | gfs2_jindex_free(sdp); |
861 | /* Take apart glock structures and buffer lists */ | 862 | /* Take apart glock structures and buffer lists */ |
863 | invalidate_inodes(sdp->sd_vfs); | ||
862 | gfs2_gl_hash_clear(sdp); | 864 | gfs2_gl_hash_clear(sdp); |
863 | /* Unmount the locking protocol */ | 865 | /* Unmount the locking protocol */ |
864 | gfs2_lm_unmount(sdp); | 866 | gfs2_lm_unmount(sdp); |
@@ -1193,7 +1195,7 @@ static void gfs2_drop_inode(struct inode *inode) | |||
1193 | { | 1195 | { |
1194 | struct gfs2_inode *ip = GFS2_I(inode); | 1196 | struct gfs2_inode *ip = GFS2_I(inode); |
1195 | 1197 | ||
1196 | if (test_bit(GIF_USER, &ip->i_flags) && inode->i_nlink) { | 1198 | if (inode->i_nlink) { |
1197 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; | 1199 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; |
1198 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) | 1200 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) |
1199 | clear_nlink(inode); | 1201 | clear_nlink(inode); |
@@ -1211,18 +1213,12 @@ static void gfs2_clear_inode(struct inode *inode) | |||
1211 | { | 1213 | { |
1212 | struct gfs2_inode *ip = GFS2_I(inode); | 1214 | struct gfs2_inode *ip = GFS2_I(inode); |
1213 | 1215 | ||
1214 | /* This tells us its a "real" inode and not one which only | 1216 | ip->i_gl->gl_object = NULL; |
1215 | * serves to contain an address space (see rgrp.c, meta_io.c) | 1217 | gfs2_glock_put(ip->i_gl); |
1216 | * which therefore doesn't have its own glocks. | 1218 | ip->i_gl = NULL; |
1217 | */ | 1219 | if (ip->i_iopen_gh.gh_gl) { |
1218 | if (test_bit(GIF_USER, &ip->i_flags)) { | 1220 | ip->i_iopen_gh.gh_gl->gl_object = NULL; |
1219 | ip->i_gl->gl_object = NULL; | 1221 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
1220 | gfs2_glock_put(ip->i_gl); | ||
1221 | ip->i_gl = NULL; | ||
1222 | if (ip->i_iopen_gh.gh_gl) { | ||
1223 | ip->i_iopen_gh.gh_gl->gl_object = NULL; | ||
1224 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | ||
1225 | } | ||
1226 | } | 1222 | } |
1227 | } | 1223 | } |
1228 | 1224 | ||
@@ -1357,9 +1353,6 @@ static void gfs2_delete_inode(struct inode *inode) | |||
1357 | struct gfs2_holder gh; | 1353 | struct gfs2_holder gh; |
1358 | int error; | 1354 | int error; |
1359 | 1355 | ||
1360 | if (!test_bit(GIF_USER, &ip->i_flags)) | ||
1361 | goto out; | ||
1362 | |||
1363 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1356 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1364 | if (unlikely(error)) { | 1357 | if (unlikely(error)) { |
1365 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | 1358 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |