public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Ensure zeroout blocks have no dirty metadata
@ 2009-12-10 17:28 Curt Wohlgemuth
  2009-12-10 17:44 ` Eric Sandeen
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Curt Wohlgemuth @ 2009-12-10 17:28 UTC (permalink / raw)
  To: ext4 development

This fixes a bug in which new blocks returned from an extent created with
ext4_ext_zeroout() can have dirty metadata still associated with them.

	Signed-off-by: Curt Wohlgemuth <curtw@google.com>
---

This is for the problem I reported on 23 Nov ("Bug in extent zeroout: blocks
not marked as new").  I'm not seeing the corruption with this fix that I was
seeing without it.

diff -uprN orig/fs/ext4/extents.c new/fs/ext4/extents.c
--- orig/fs/ext4/extents.c	2009-12-09 15:09:25.000000000 -0800
+++ new/fs/ext4/extents.c	2009-12-09 15:09:37.000000000 -0800
@@ -2474,9 +2474,21 @@ static int ext4_ext_zeroout(struct inode
 		submit_bio(WRITE, bio);
 		wait_for_completion(&event);

-		if (test_bit(BIO_UPTODATE, &bio->bi_flags))
+		/* On success, we need to insure all metadata associated
+		 * with each of these blocks is unmapped. */
+		if (test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+			sector_t block = ee_pblock;
+
 			ret = 0;
-		else {
+			done = 0;
+			while (done < len) {
+				unmap_underlying_metadata(inode->i_sb->s_bdev,
+							  block);
+
+				done++;
+				block++;
+			}
+		} else {
 			ret = -EIO;
 			break;
 		}

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-12-29 23:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 17:28 [PATCH] ext4: Ensure zeroout blocks have no dirty metadata Curt Wohlgemuth
2009-12-10 17:44 ` Eric Sandeen
2009-12-10 18:01   ` Curt Wohlgemuth
2009-12-11  9:09 ` Andreas Dilger
2009-12-11 22:01   ` Curt Wohlgemuth
2009-12-11 23:27     ` Andreas Dilger
2009-12-15 22:33       ` Curt Wohlgemuth
2009-12-18 11:49 ` Aneesh Kumar K.V
2009-12-18 12:10   ` Aneesh Kumar K.V
2009-12-18 23:11     ` Curt Wohlgemuth
2009-12-29 17:56   ` Curt Wohlgemuth
2009-12-29 18:53     ` tytso
2009-12-29 23:23       ` Curt Wohlgemuth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox