shithub: lwext4

Download patch

ref: 8fbe41ad9192b7f32025063298cc7c5786c6cd56
parent: 3b136f8a7036606a9e6c130ee292da2a9ae39123
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Wed Dec 16 05:49:38 EST 2015

ext4_bcache: do not flush data in an invalid buffer.

--- a/lwext4/ext4_bcache.c
+++ b/lwext4/ext4_bcache.c
@@ -232,7 +232,8 @@
 	if (!buf->refctr) {
 		RB_INSERT(ext4_buf_lru, &bc->lru_root, buf);
 		/* This buffer is ready to be flushed. */
-		if (ext4_bcache_test_flag(buf, BC_DIRTY)) {
+		if (ext4_bcache_test_flag(buf, BC_DIRTY) &&
+		    ext4_bcache_test_flag(buf, BC_UPTODATE)) {
 			if (bc->bdev->cache_write_back &&
 			    !ext4_bcache_test_flag(buf, BC_FLUSH))
 				ext4_bcache_insert_dirty_node(bc, buf);