Skip to content

Commit

Permalink
ocfs2: do not BUG if buffer not uptodate in __ocfs2_journal_access
Browse files Browse the repository at this point in the history
When storage network is unstable, it may trigger the BUG in
__ocfs2_journal_access because of buffer not uptodate.  We can retry the
write in this case or return error instead of BUG.

Signed-off-by: Joseph Qi <[email protected]>
Reported-by: Zhangguanghui <[email protected]>
Tested-by: Zhangguanghui <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
josephhz authored and torvalds committed Sep 4, 2015
1 parent faaebf1 commit acf8fdb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion fs/ocfs2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,23 @@ static int __ocfs2_journal_access(handle_t *handle,
mlog(ML_ERROR, "giving me a buffer that's not uptodate!\n");
mlog(ML_ERROR, "b_blocknr=%llu\n",
(unsigned long long)bh->b_blocknr);
BUG();

lock_buffer(bh);
/*
* A previous attempt to write this buffer head failed.
* Nothing we can do but to retry the write and hope for
* the best.
*/
if (buffer_write_io_error(bh) && !buffer_uptodate(bh)) {
clear_buffer_write_io_error(bh);
set_buffer_uptodate(bh);
}

if (!buffer_uptodate(bh)) {
unlock_buffer(bh);
return -EIO;
}
unlock_buffer(bh);
}

/* Set the current transaction information on the ci so
Expand Down

0 comments on commit acf8fdb

Please sign in to comment.