ref: fa3b47a25d4759afc71556478d1e76bfca27e7ea
parent: 9241e3c99524f9a87eb2c30d9e7cc5b33bff8bce
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sun Dec 27 12:35:08 EST 2015
ext4_journal: fix jbd_trans_get_access flushing the wrong buffer.
--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -1123,13 +1123,16 @@
{
int r = EOK;
struct ext4_fs *fs = journal->jbd_fs->inode_ref.fs;
+ struct jbd_buf *jbd_buf = block->buf->end_write_arg;
/* If the buffer has already been modified, we should
* flush dirty data in this buffer to disk.*/
if (ext4_bcache_test_flag(block->buf, BC_DIRTY) &&
- block->buf->end_write == jbd_trans_end_write &&
- block->buf->end_write_arg != trans) {
- r = ext4_block_flush_buf(fs->bdev, block->buf);
+ block->buf->end_write == jbd_trans_end_write) {
+ ext4_assert(jbd_buf);
+ if (jbd_buf->trans != trans)
+ r = ext4_block_flush_buf(fs->bdev, block->buf);
+
}
return r;
}