From: Curt Wohlgemuth <curtw@google.com>
To: tytso@mit.edu
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: Ensure zeroout blocks have no dirty metadata
Date: Tue, 29 Dec 2009 15:23:38 -0800 [thread overview]
Message-ID: <6601abe90912291523g9c31912oa64254d88e49ae4@mail.gmail.com> (raw)
In-Reply-To: <20091229185318.GJ4429@thunk.org>
Hi Ted:
On Tue, Dec 29, 2009 at 10:53 AM, <tytso@mit.edu> wrote:
> On Tue, Dec 29, 2009 at 09:56:29AM -0800, Curt Wohlgemuth wrote:
>>
>> Thanks for pointing out the arithmetic problems in my patch. Yours
>> below looks good to me.
>
> Hi Curt,
>
> Can you do me a favor and send out a full patch with Aneesh's
> correction?
Here it is. This is against 2.6.33-rc2, if that makes a difference. Thanks!
====================================================================
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.
This patch was originally by Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>.
Signed-off-by: Curt Wohlgemuth <curtw@google.com>
---
diff -uprN orig/fs/ext4/extents.c new/fs/ext4/extents.c
--- orig/fs/ext4/extents.c 2009-12-29 14:59:12.000000000 -0800
+++ new/fs/ext4/extents.c 2009-12-29 15:18:43.000000000 -0800
@@ -3023,6 +3023,14 @@ out:
return err;
}
+static void unmap_underlying_metadata_blocks(struct block_device *bdev,
+ sector_t block, int count)
+{
+ int i;
+ for (i = 0; i < count; i++)
+ unmap_underlying_metadata(bdev, block + i);
+}
+
static int
ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
ext4_lblk_t iblock, unsigned int max_blocks,
@@ -3098,6 +3106,18 @@ out:
} else
allocated = ret;
set_buffer_new(bh_result);
+ /*
+ * if we allocated more blocks than requested
+ * we need to make sure we unmap the extra block
+ * allocated. The actual needed block will get
+ * unmapped later when we find the buffer_head marked
+ * new.
+ */
+ if (allocated > max_blocks) {
+ unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
+ newblock + max_blocks,
+ allocated - max_blocks);
+ }
map_out:
set_buffer_mapped(bh_result);
out1:
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2009-12-29 23:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6601abe90912291523g9c31912oa64254d88e49ae4@mail.gmail.com \
--to=curtw@google.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox