From: Theodore Ts'o <tytso@mit.edu>
To: linux-ext4@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] ext2fs_zero_blocks: Avoid clearing more blocks than requested
Date: Tue, 17 Jun 2008 02:06:31 -0400 [thread overview]
Message-ID: <1213682792-4878-3-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1213682792-4878-2-git-send-email-tytso@mit.edu>
This could cause certain mke2fs feature combinations to result in the
initial blocks of the inode table getting wiped out when the journal
is created.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/mkjournal.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index ca8e733..e55dcbd 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -170,9 +170,11 @@ errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
/* OK, do the write loop */
j=0;
while (j < num) {
- if (blk % STRIDE_LENGTH)
+ if (blk % STRIDE_LENGTH) {
count = STRIDE_LENGTH - (blk % STRIDE_LENGTH);
- else {
+ if (count > (num - j))
+ count = num - j;
+ } else {
count = num - j;
if (count > STRIDE_LENGTH)
count = STRIDE_LENGTH;
--
1.5.6.rc3.1.g36b7.dirty
next prev parent reply other threads:[~2008-06-17 6:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 6:06 e2fsprogs: Patches to resize2fs Theodore Ts'o
2008-06-17 6:06 ` [PATCH] resize2fs: Fix support for the uninit_bg feature Theodore Ts'o
2008-06-17 6:06 ` Theodore Ts'o [this message]
2008-06-17 6:06 ` [PATCH] resize2fs: Prohibit the combination of flex_bg and !resize_inode Theodore Ts'o
2008-06-17 15:16 ` [PATCH] resize2fs: Fix support for the uninit_bg feature Andreas Dilger
2008-06-17 16:30 ` Theodore Tso
2008-06-23 20:42 ` Andreas Dilger
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=1213682792-4878-3-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
/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