public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: linux-ext4@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] Fix commit block write in JBD2
Date: Wed, 23 Jan 2008 20:10:54 +0100	[thread overview]
Message-ID: <20080123191054.GH10144@duck.suse.cz> (raw)
In-Reply-To: <20080123190943.GG10144@duck.suse.cz>

On Wed 23-01-08 20:09:43, Jan Kara wrote:
>   Hi,
> 
>   the patch below fixes preparation of commit block in
> journal_write_commit_record(). Obviously the bug doesn't really matter
> since nobody reported it so far but let's cleanup the code... Andrew, could
> you please queue it up? Thanks.
  And the same fix for JBD2.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---

Commit block is expected to have several copies of the header. Fix the
bug Andrew has spotted ages ago.

Signed-off-by: Jan Kara <jack@suse.cz>

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 6986f33..ed61283 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -116,9 +116,8 @@ static int journal_write_commit_record(journal_t *journal,
 
 	bh = jh2bh(descriptor);
 
-	/* AKPM: buglet - add `i' to tmp! */
 	for (i = 0; i < bh->b_size; i += 512) {
-		journal_header_t *tmp = (journal_header_t*)bh->b_data;
+		journal_header_t *tmp = (journal_header_t*)(bh->b_data+i);
 		tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
 		tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK);
 		tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);

  reply	other threads:[~2008-01-23 19:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23 19:09 [PATCH] Fix commit block write in JBD Jan Kara
2008-01-23 19:10 ` Jan Kara [this message]
2008-01-23 21:18   ` [PATCH] Fix commit block write in JBD2 Girish Shilamkar
2008-01-23 22:01     ` Jan Kara
2008-01-27  6:02 ` [PATCH] Fix commit block write in JBD Andrew Morton
2008-01-28 13:18   ` Jan Kara

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=20080123191054.GH10144@duck.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --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