diff options
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r-- | fs/reiserfs/journal.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 4b15761434b..4491fcf2a0e 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s, | |||
1039 | } | 1039 | } |
1040 | atomic_dec(&journal->j_async_throttle); | 1040 | atomic_dec(&journal->j_async_throttle); |
1041 | 1041 | ||
1042 | /* We're skipping the commit if there's an error */ | ||
1043 | if (retval || reiserfs_is_journal_aborted(journal)) | ||
1044 | barrier = 0; | ||
1045 | |||
1042 | /* wait on everything written so far before writing the commit | 1046 | /* wait on everything written so far before writing the commit |
1043 | * if we are in barrier mode, send the commit down now | 1047 | * if we are in barrier mode, send the commit down now |
1044 | */ | 1048 | */ |
@@ -1077,10 +1081,16 @@ static int flush_commit_list(struct super_block *s, | |||
1077 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); | 1081 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); |
1078 | 1082 | ||
1079 | if (!barrier) { | 1083 | if (!barrier) { |
1080 | if (buffer_dirty(jl->j_commit_bh)) | 1084 | /* If there was a write error in the journal - we can't commit |
1081 | BUG(); | 1085 | * this transaction - it will be invalid and, if successful, |
1082 | mark_buffer_dirty(jl->j_commit_bh); | 1086 | * will just end up propogating the write error out to |
1083 | sync_dirty_buffer(jl->j_commit_bh); | 1087 | * the file system. */ |
1088 | if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { | ||
1089 | if (buffer_dirty(jl->j_commit_bh)) | ||
1090 | BUG(); | ||
1091 | mark_buffer_dirty(jl->j_commit_bh) ; | ||
1092 | sync_dirty_buffer(jl->j_commit_bh) ; | ||
1093 | } | ||
1084 | } else | 1094 | } else |
1085 | wait_on_buffer(jl->j_commit_bh); | 1095 | wait_on_buffer(jl->j_commit_bh); |
1086 | 1096 | ||
@@ -2757,6 +2767,15 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2757 | journal->j_cnode_used = 0; | 2767 | journal->j_cnode_used = 0; |
2758 | journal->j_must_wait = 0; | 2768 | journal->j_must_wait = 0; |
2759 | 2769 | ||
2770 | if (journal->j_cnode_free == 0) { | ||
2771 | reiserfs_warning(p_s_sb, "journal-2004: Journal cnode memory " | ||
2772 | "allocation failed (%ld bytes). Journal is " | ||
2773 | "too large for available memory. Usually " | ||
2774 | "this is due to a journal that is too large.", | ||
2775 | sizeof (struct reiserfs_journal_cnode) * num_cnodes); | ||
2776 | goto free_and_return; | ||
2777 | } | ||
2778 | |||
2760 | init_journal_hash(p_s_sb); | 2779 | init_journal_hash(p_s_sb); |
2761 | jl = journal->j_current_jl; | 2780 | jl = journal->j_current_jl; |
2762 | jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl); | 2781 | jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl); |
@@ -3906,10 +3925,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3906 | flush = 1; | 3925 | flush = 1; |
3907 | } | 3926 | } |
3908 | #ifdef REISERFS_PREALLOCATE | 3927 | #ifdef REISERFS_PREALLOCATE |
3909 | /* quota ops might need to nest, setup the journal_info pointer for them */ | 3928 | /* quota ops might need to nest, setup the journal_info pointer for them |
3929 | * and raise the refcount so that it is > 0. */ | ||
3910 | current->journal_info = th; | 3930 | current->journal_info = th; |
3931 | th->t_refcount++; | ||
3911 | reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into | 3932 | reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into |
3912 | * the transaction */ | 3933 | * the transaction */ |
3934 | th->t_refcount--; | ||
3913 | current->journal_info = th->t_handle_save; | 3935 | current->journal_info = th->t_handle_save; |
3914 | #endif | 3936 | #endif |
3915 | 3937 | ||