aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-06-12 10:20:41 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-31 01:45:50 -0400
commit39263d5e71d0fad09eab0d855a9407ad2af8378c (patch)
treeea0be08c4c0fc1f022683b9e0fb43f27ee866e7c /fs
parentfef6925cd4c6b564ecff477e07a0fca987542223 (diff)
gfs2: Convert to new freezing mechanism
We update gfs2_page_mkwrite() to use new freeze protection and the transaction code to use freeze protection while the transaction is running. That is needed to stop iput() of unlinked file from modifying the filesystem. The rest is handled by the generic code. CC: cluster-devel@redhat.com CC: Steven Whitehouse <swhiteho@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/file.c15
-rw-r--r--fs/gfs2/trans.c4
2 files changed, 7 insertions, 12 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 07959150d44e..8ffeb031248e 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -370,11 +370,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
370 loff_t size; 370 loff_t size;
371 int ret; 371 int ret;
372 372
373 /* Wait if fs is frozen. This is racy so we check again later on 373 sb_start_pagefault(inode->i_sb);
374 * and retry if the fs has been frozen after the page lock has
375 * been acquired
376 */
377 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
378 374
379 /* Update file times before taking page lock */ 375 /* Update file times before taking page lock */
380 file_update_time(vma->vm_file); 376 file_update_time(vma->vm_file);
@@ -458,14 +454,9 @@ out:
458 gfs2_holder_uninit(&gh); 454 gfs2_holder_uninit(&gh);
459 if (ret == 0) { 455 if (ret == 0) {
460 set_page_dirty(page); 456 set_page_dirty(page);
461 /* This check must be post dropping of transaction lock */ 457 wait_on_page_writeback(page);
462 if (inode->i_sb->s_frozen == SB_UNFROZEN) {
463 wait_on_page_writeback(page);
464 } else {
465 ret = -EAGAIN;
466 unlock_page(page);
467 }
468 } 458 }
459 sb_end_pagefault(inode->i_sb);
469 return block_page_mkwrite_return(ret); 460 return block_page_mkwrite_return(ret);
470} 461}
471 462
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index ad3e2fb763d7..adbd27875ef9 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -50,6 +50,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
50 if (revokes) 50 if (revokes)
51 tr->tr_reserved += gfs2_struct2blk(sdp, revokes, 51 tr->tr_reserved += gfs2_struct2blk(sdp, revokes,
52 sizeof(u64)); 52 sizeof(u64));
53 sb_start_intwrite(sdp->sd_vfs);
53 gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); 54 gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh);
54 55
55 error = gfs2_glock_nq(&tr->tr_t_gh); 56 error = gfs2_glock_nq(&tr->tr_t_gh);
@@ -68,6 +69,7 @@ fail_gunlock:
68 gfs2_glock_dq(&tr->tr_t_gh); 69 gfs2_glock_dq(&tr->tr_t_gh);
69 70
70fail_holder_uninit: 71fail_holder_uninit:
72 sb_end_intwrite(sdp->sd_vfs);
71 gfs2_holder_uninit(&tr->tr_t_gh); 73 gfs2_holder_uninit(&tr->tr_t_gh);
72 kfree(tr); 74 kfree(tr);
73 75
@@ -116,6 +118,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
116 gfs2_holder_uninit(&tr->tr_t_gh); 118 gfs2_holder_uninit(&tr->tr_t_gh);
117 kfree(tr); 119 kfree(tr);
118 } 120 }
121 sb_end_intwrite(sdp->sd_vfs);
119 return; 122 return;
120 } 123 }
121 124
@@ -136,6 +139,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
136 139
137 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) 140 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
138 gfs2_log_flush(sdp, NULL); 141 gfs2_log_flush(sdp, NULL);
142 sb_end_intwrite(sdp->sd_vfs);
139} 143}
140 144
141/** 145/**