public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Beregalov <a.beregalov@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Subject: [PATCH] Btrfs: fix unaligned access at btrfs_csum_final()
Date: Mon, 22 Mar 2010 02:31:08 +0300	[thread overview]
Message-ID: <1269214268-1151-1-git-send-email-a.beregalov@gmail.com> (raw)

Btrfs on Sparc64 produces a lot of warnings
Kernel unaligned access at TPC[10148c84] btrfs_csum_final+0x44/0x60 [btrfs]

It happens when btrfs_csum_final is called from write_dev_supers():
2195:	btrfs_csum_final(crc, sb->csum);

crc is u32, aligning sb->csum on 4-byte boundary fixes the problem.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
 fs/btrfs/ctree.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 0af2e38..4dbf330 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -327,7 +327,7 @@ struct btrfs_header {
  * it currently lacks any block count etc etc
  */
 struct btrfs_super_block {
-	u8 csum[BTRFS_CSUM_SIZE];
+	u8 csum[BTRFS_CSUM_SIZE] __attribute__ ((aligned(4)));
 	/* the first 4 fields must match struct btrfs_header */
 	u8 fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */
 	__le64 bytenr; /* this block number */
-- 
1.7.0.2


             reply	other threads:[~2010-03-21 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-21 23:31 Alexander Beregalov [this message]
2010-03-23 15:34 ` [PATCH] Btrfs: fix unaligned access at btrfs_csum_final() Chris Mason
2010-03-24  0:51   ` Chris Mason

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=1269214268-1151-1-git-send-email-a.beregalov@gmail.com \
    --to=a.beregalov@gmail.com \
    --cc=linux-btrfs@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