[Ocfs2-devel] [PATCH v2] ocfs2: do not BUG if jbd2_journal_dirty_metadata fails

Joseph Qi joseph.qi at huawei.com
Wed May 20 03:25:16 PDT 2015


On 2015/5/20 16:22, Junxiao Bi wrote:
> On 05/12/2015 09:53 AM, Joseph Qi wrote:
>> jbd2_journal_dirty_metadata may fail. Currently it cannot take care of
>> non zero return value and just BUG in ocfs2_journal_dirty.
>> This patch is aborting the handle and journal instead of BUG.
>>
>> Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
>> Cc: joyce.xue <xuejiufei at huawei.com>
>> ---
>>  fs/ocfs2/journal.c | 12 +++++++++++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
>> index ff53192..eefca1e 100644
>> --- a/fs/ocfs2/journal.c
>> +++ b/fs/ocfs2/journal.c
>> @@ -775,7 +775,17 @@ void ocfs2_journal_dirty(handle_t *handle, struct buffer_head *bh)
>>  	trace_ocfs2_journal_dirty((unsigned long long)bh->b_blocknr);
>>
>>  	status = jbd2_journal_dirty_metadata(handle, bh);
>> -	BUG_ON(status);
>> +	if (status) {
>> +		mlog_errno(status);
>> +		if (!is_handle_aborted(handle)) {
>> +			journal_t *journal = handle->h_transaction->t_journal;
>> +
>> +			mlog(ML_ERROR, "jbd2_journal_dirty_metadata failed. "
>> +					"Aborting transaction and journal.");
>> +			handle->h_err = status;
>> +			jbd2_journal_abort_handle(handle);
>> +			jbd2_journal_abort(journal, status);
> Let fs go after journal lose affect seemed not safe, may we set fs
> read-only here?
> 
> Thanks,
> Junxiao.
> 
> 
Do you mean journal can still be updated even if it is aborted?

>> +		}
>> +	}
>>  }
>>
>>  #define OCFS2_DEFAULT_COMMIT_INTERVAL	(HZ * JBD2_DEFAULT_MAX_COMMIT_AGE)
>>
> 
> 
> 





More information about the Ocfs2-devel mailing list