diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-24 21:38:12 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-14 01:18:29 -0400 |
commit | 7e94277050e31aa4204060f03953bba72598cf7d (patch) | |
tree | 7a53cd463e76c0ed5e72345152755b5318ad430b /fs/reiserfs | |
parent | b10ab4c337a600456ed2d9daea0331016f7cdeeb (diff) |
kill-the-bkl/reiserfs: fix recursive reiserfs write lock in reiserfs_commit_write()
reiserfs_commit_write() is always called with the write lock held.
Thus the current calls to reiserfs_write_lock() in this function are
acquiring the lock recursively.
We can safely drop them.
This also solves further assumptions for this lock to be really
released while calling reiserfs_write_unlock().
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Laurent Riffard <laurent.riffard@free.fr>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/inode.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 853f4f6fe920..965c8eaadb1e 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -2795,7 +2795,6 @@ int reiserfs_commit_write(struct file *f, struct page *page, | |||
2795 | */ | 2795 | */ |
2796 | if (pos > inode->i_size) { | 2796 | if (pos > inode->i_size) { |
2797 | struct reiserfs_transaction_handle myth; | 2797 | struct reiserfs_transaction_handle myth; |
2798 | reiserfs_write_lock(inode->i_sb); | ||
2799 | /* If the file have grown beyond the border where it | 2798 | /* If the file have grown beyond the border where it |
2800 | can have a tail, unmark it as needing a tail | 2799 | can have a tail, unmark it as needing a tail |
2801 | packing */ | 2800 | packing */ |
@@ -2806,10 +2805,9 @@ int reiserfs_commit_write(struct file *f, struct page *page, | |||
2806 | REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; | 2805 | REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; |
2807 | 2806 | ||
2808 | ret = journal_begin(&myth, inode->i_sb, 1); | 2807 | ret = journal_begin(&myth, inode->i_sb, 1); |
2809 | if (ret) { | 2808 | if (ret) |
2810 | reiserfs_write_unlock(inode->i_sb); | ||
2811 | goto journal_error; | 2809 | goto journal_error; |
2812 | } | 2810 | |
2813 | reiserfs_update_inode_transaction(inode); | 2811 | reiserfs_update_inode_transaction(inode); |
2814 | inode->i_size = pos; | 2812 | inode->i_size = pos; |
2815 | /* | 2813 | /* |
@@ -2821,16 +2819,13 @@ int reiserfs_commit_write(struct file *f, struct page *page, | |||
2821 | reiserfs_update_sd(&myth, inode); | 2819 | reiserfs_update_sd(&myth, inode); |
2822 | update_sd = 1; | 2820 | update_sd = 1; |
2823 | ret = journal_end(&myth, inode->i_sb, 1); | 2821 | ret = journal_end(&myth, inode->i_sb, 1); |
2824 | reiserfs_write_unlock(inode->i_sb); | ||
2825 | if (ret) | 2822 | if (ret) |
2826 | goto journal_error; | 2823 | goto journal_error; |
2827 | } | 2824 | } |
2828 | if (th) { | 2825 | if (th) { |
2829 | reiserfs_write_lock(inode->i_sb); | ||
2830 | if (!update_sd) | 2826 | if (!update_sd) |
2831 | mark_inode_dirty(inode); | 2827 | mark_inode_dirty(inode); |
2832 | ret = reiserfs_end_persistent_transaction(th); | 2828 | ret = reiserfs_end_persistent_transaction(th); |
2833 | reiserfs_write_unlock(inode->i_sb); | ||
2834 | if (ret) | 2829 | if (ret) |
2835 | goto out; | 2830 | goto out; |
2836 | } | 2831 | } |
@@ -2840,11 +2835,9 @@ int reiserfs_commit_write(struct file *f, struct page *page, | |||
2840 | 2835 | ||
2841 | journal_error: | 2836 | journal_error: |
2842 | if (th) { | 2837 | if (th) { |
2843 | reiserfs_write_lock(inode->i_sb); | ||
2844 | if (!update_sd) | 2838 | if (!update_sd) |
2845 | reiserfs_update_sd(th, inode); | 2839 | reiserfs_update_sd(th, inode); |
2846 | ret = reiserfs_end_persistent_transaction(th); | 2840 | ret = reiserfs_end_persistent_transaction(th); |
2847 | reiserfs_write_unlock(inode->i_sb); | ||
2848 | } | 2841 | } |
2849 | 2842 | ||
2850 | return ret; | 2843 | return ret; |