diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f4ef0b745a53f97b5547199e1d8cd6d0b65bb367..7733e29433678fad16c22687184bd9ece4705be4 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2580,6 +2580,8 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
 				 */
 				if (allocated > max_blocks)
 					allocated = max_blocks;
+				/* mark the buffer unwritten */
+				__set_bit(BH_Unwritten, &bh_result->b_state);
 				goto out2;
 			}