aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/inode.c4
-rw-r--r--fs/reiserfs/journal.c13
2 files changed, 16 insertions, 1 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index ffa34b861bdb..60e2f2344703 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2743,6 +2743,7 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
2743 int ret = 1; 2743 int ret = 1;
2744 struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb); 2744 struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
2745 2745
2746 lock_buffer(bh);
2746 spin_lock(&j->j_dirty_buffers_lock); 2747 spin_lock(&j->j_dirty_buffers_lock);
2747 if (!buffer_mapped(bh)) { 2748 if (!buffer_mapped(bh)) {
2748 goto free_jh; 2749 goto free_jh;
@@ -2758,7 +2759,7 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
2758 if (buffer_journaled(bh) || buffer_journal_dirty(bh)) { 2759 if (buffer_journaled(bh) || buffer_journal_dirty(bh)) {
2759 ret = 0; 2760 ret = 0;
2760 } 2761 }
2761 } else if (buffer_dirty(bh) || buffer_locked(bh)) { 2762 } else if (buffer_dirty(bh)) {
2762 struct reiserfs_journal_list *jl; 2763 struct reiserfs_journal_list *jl;
2763 struct reiserfs_jh *jh = bh->b_private; 2764 struct reiserfs_jh *jh = bh->b_private;
2764 2765
@@ -2784,6 +2785,7 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
2784 reiserfs_free_jh(bh); 2785 reiserfs_free_jh(bh);
2785 } 2786 }
2786 spin_unlock(&j->j_dirty_buffers_lock); 2787 spin_unlock(&j->j_dirty_buffers_lock);
2788 unlock_buffer(bh);
2787 return ret; 2789 return ret;
2788} 2790}
2789 2791
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 2d04efb22eea..bc8fe963b3cc 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -877,6 +877,19 @@ static int write_ordered_buffers(spinlock_t * lock,
877 if (!buffer_uptodate(bh)) { 877 if (!buffer_uptodate(bh)) {
878 ret = -EIO; 878 ret = -EIO;
879 } 879 }
880 /* ugly interaction with invalidatepage here.
881 * reiserfs_invalidate_page will pin any buffer that has a valid
882 * journal head from an older transaction. If someone else sets
883 * our buffer dirty after we write it in the first loop, and
884 * then someone truncates the page away, nobody will ever write
885 * the buffer. We're safe if we write the page one last time
886 * after freeing the journal header.
887 */
888 if (buffer_dirty(bh) && unlikely(bh->b_page->mapping == NULL)) {
889 spin_unlock(lock);
890 ll_rw_block(WRITE, 1, &bh);
891 spin_lock(lock);
892 }
880 put_bh(bh); 893 put_bh(bh);
881 cond_resched_lock(lock); 894 cond_resched_lock(lock);
882 } 895 }