shithub: lwext4

Download patch

ref: 3cd8523e39ddd70f45bdff22696e411e018259fa
parent: 79b5a450046b433f7c6080396ed0871f1b76ba28
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sun Dec 20 05:26:24 EST 2015

ext4_blockdev: flush data only when buffer is dirty and up-to-date.

--- a/lwext4/ext4_blockdev.c
+++ b/lwext4/ext4_blockdev.c
@@ -141,7 +141,8 @@
 	int r;
 	struct ext4_bcache *bc = bdev->bc;
 
-	if (ext4_bcache_test_flag(buf, BC_DIRTY)) {
+	if (ext4_bcache_test_flag(buf, BC_DIRTY) &&
+	    ext4_bcache_test_flag(buf, BC_UPTODATE)) {
 		r = ext4_blocks_set_direct(bdev, buf->data, buf->lba, 1);
 
 		if (r) {