public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: David Chinner <dgc@sgi.com>
Cc: xfs-dev <xfs-dev@sgi.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [patch] detect and correct bad features2 superblock field
Date: Sat, 29 Mar 2008 11:19:06 -0500	[thread overview]
Message-ID: <47EE6BFA.70603@sandeen.net> (raw)
In-Reply-To: <47EDB6AD.4070604@sandeen.net>

Eric Sandeen wrote:
> David Chinner wrote:
>> There is a bug in mkfs.xfs that can result in writing the features2
>> field in the superblock to the wrong location. This only occurs
>> on some architectures, typically those with 32 bit userspace and
>> 64 bit kernels.
>>
>> This patch detects the defect at mount time, logs a warning
>> such as:
>> ...
> 
>>  	/*
>> +	 * Check for a bad features2 field alignment. This happened on
>> +	 * some platforms due to xfs_sb_t not being 64bit size aligned
>> +	 * when sb_features was added and hence the compiler put it in
>> +	 * the wrong place.
>> +	 *
>> +	 * If we detect a bad field, we or the set bits into the existing
>> +	 * features2 field in case it has already been modified and we
>> +	 * don't want to lose any features. Zero the bad one and mark
>> +	 * the two fields as needing updates once the transaction subsystem
>> +	 * is online.
>> +	 */
>> +	if (xfs_sb_has_bad_features2(sbp)) {
>> +		cmn_err(CE_WARN,
>> +			"XFS: correcting sb_features alignment problem");
>> +		sbp->sb_features2 |= sbp->sb_bad_features2;
>> +		sbp->sb_bad_features2 = 0;
>> +		update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
>> +	}
>>   
> I think there's a minor problem here that while this will update the
> superblock with the proper features2 values, features2 has already been
> checked, so mp->m_flags won't have, for example, the attr2 flags...
> 
> So attr2 will show up next time, but not on this mount.

How's this look for a fixup:

========================

[XFS]: set ATTR2 in m_flags if flag found in bad_features2

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---


Index: linux-2.6.24.x86_64/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6.24.x86_64.orig/fs/xfs/xfs_mount.c
+++ linux-2.6.24.x86_64/fs/xfs/xfs_mount.c
@@ -1925,6 +1925,12 @@ xfs_mount_log_sb(
 	}
 	xfs_mod_sb(tp, fields);
 	xfs_trans_commit(tp, 0);
+
+	/* if we updated features2, recheck attr2 & set flag */
+	if ((fields & (XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2)) &&
+				XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
+		mp->m_flags |= XFS_MOUNT_ATTR2;
+	}
 }

  reply	other threads:[~2008-03-29 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-20  5:40 [patch] detect and correct bad features2 superblock field David Chinner
2008-02-20 14:09 ` Eric Sandeen
2008-02-20 19:13 ` Christoph Hellwig
2008-02-21 22:49   ` David Chinner
2008-03-29  3:25 ` Eric Sandeen
2008-03-29 16:19   ` Eric Sandeen [this message]
2008-03-30  1:30 ` Eric Sandeen
2008-03-30  1:49   ` Eric Sandeen
2008-03-30  4:50   ` Josef 'Jeff' Sipek
2008-03-30  4:53     ` Eric Sandeen
2008-03-30  5:29       ` Josef 'Jeff' Sipek

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=47EE6BFA.70603@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=dgc@sgi.com \
    --cc=xfs-dev@sgi.com \
    --cc=xfs@oss.sgi.com \
    /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