aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorJosef Whiter <jwhiter@redhat.com>2007-03-12 17:55:07 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-05-01 04:10:37 -0400
commit1de913909263ba7f7054debeda1b79771a7233db (patch)
tree050e17a500f4dbe0d4d56e1b25af8243d5fe6ab8 /fs/gfs2
parent89adc934f3f96600e7f31447426c7e99d62c5460 (diff)
[GFS2] Fix bz 231380, unlock page before dequeing glocks in gfs2_commit_write
If we are writing a file, and in the middle of writing the file another node attempts to get a shared lock on that file (by doing a du for example) the process doing the writing will hang waiting on lock_page. The reason for this is because when we have waiters on a exclusive glock, we will go through and flush out all dirty pages associated with that inode and release the lock. The problem is that when we flush the dirty pages, we could hit a page that we have locked durring the generic_file_buffered_write part of this operation. This patch unlocks the page before we go to dequeue the lock and locks it immediatly afterwards, since generic_file_buffered_write needs the page locked when the commit_write is completed. This patch resolves the problem, however if somebody sees a better way to do this please don't hesistate to yell. Signed-off-by: Josef Whiter <jwhiter@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/ops_address.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index b3b7e8475359..90c287932d58 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -507,7 +507,9 @@ static int gfs2_commit_write(struct file *file, struct page *page,
507 gfs2_quota_unlock(ip); 507 gfs2_quota_unlock(ip);
508 gfs2_alloc_put(ip); 508 gfs2_alloc_put(ip);
509 } 509 }
510 unlock_page(page);
510 gfs2_glock_dq_m(1, &ip->i_gh); 511 gfs2_glock_dq_m(1, &ip->i_gh);
512 lock_page(page);
511 gfs2_holder_uninit(&ip->i_gh); 513 gfs2_holder_uninit(&ip->i_gh);
512 return 0; 514 return 0;
513 515
@@ -520,7 +522,9 @@ fail_endtrans:
520 gfs2_quota_unlock(ip); 522 gfs2_quota_unlock(ip);
521 gfs2_alloc_put(ip); 523 gfs2_alloc_put(ip);
522 } 524 }
525 unlock_page(page);
523 gfs2_glock_dq_m(1, &ip->i_gh); 526 gfs2_glock_dq_m(1, &ip->i_gh);
527 lock_page(page);
524 gfs2_holder_uninit(&ip->i_gh); 528 gfs2_holder_uninit(&ip->i_gh);
525fail_nounlock: 529fail_nounlock:
526 ClearPageUptodate(page); 530 ClearPageUptodate(page);