All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 10/10] xfs: check minimum block size for CRC filesystems
Date: Fri, 04 Nov 2016 17:10:57 -0700	[thread overview]
Message-ID: <147830465785.27129.17151401159795461152.stgit@birch.djwong.org> (raw)
In-Reply-To: <147830459629.27129.4541676333173489075.stgit@birch.djwong.org>

Check the minimum block size on v5 filesystems.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_sb.c    |    7 +++++++
 fs/xfs/libxfs/xfs_types.h |    3 +++
 2 files changed, 10 insertions(+)


diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 7a39240..49b03e6 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -262,6 +262,13 @@ xfs_mount_validate_sb(
 		return -EFSCORRUPTED;
 	}
 
+	if (xfs_sb_version_hascrc(&mp->m_sb) &&
+	    unlikely(
+	    sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE)) {
+		xfs_notice(mp, "v5 SB sanity check failed");
+		return -EFSCORRUPTED;
+	}
+
 	/*
 	 * Until this is fixed only page-sized or smaller data blocks work.
 	 */
diff --git a/fs/xfs/libxfs/xfs_types.h b/fs/xfs/libxfs/xfs_types.h
index 8d74870..cf044c0 100644
--- a/fs/xfs/libxfs/xfs_types.h
+++ b/fs/xfs/libxfs/xfs_types.h
@@ -75,11 +75,14 @@ typedef __int64_t	xfs_sfiloff_t;	/* signed block number in a file */
  * Minimum and maximum blocksize and sectorsize.
  * The blocksize upper limit is pretty much arbitrary.
  * The sectorsize upper limit is due to sizeof(sb_sectsize).
+ * CRC enable filesystems use 512 byte inodes, meaning 512 byte block sizes
+ * cannot be used.
  */
 #define XFS_MIN_BLOCKSIZE_LOG	9	/* i.e. 512 bytes */
 #define XFS_MAX_BLOCKSIZE_LOG	16	/* i.e. 65536 bytes */
 #define XFS_MIN_BLOCKSIZE	(1 << XFS_MIN_BLOCKSIZE_LOG)
 #define XFS_MAX_BLOCKSIZE	(1 << XFS_MAX_BLOCKSIZE_LOG)
+#define XFS_MIN_CRC_BLOCKSIZE	(1 << (XFS_MIN_BLOCKSIZE_LOG + 1))
 #define XFS_MIN_SECTORSIZE_LOG	9	/* i.e. 512 bytes */
 #define XFS_MAX_SECTORSIZE_LOG	15	/* i.e. 32768 bytes */
 #define XFS_MIN_SECTORSIZE	(1 << XFS_MIN_SECTORSIZE_LOG)


  parent reply	other threads:[~2016-11-05  0:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05  0:09 [PATCH v2 00/10] xfs: miscellaneous libxfs cleanups Darrick J. Wong
2016-11-05  0:10 ` [PATCH 01/10] libxfs: convert ushort to unsigned short Darrick J. Wong
2016-11-15 10:22   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 02/10] libxfs: synchronize dinode_verify with userspace Darrick J. Wong
2016-11-15 10:23   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 03/10] libxfs: fix whitespace problems Darrick J. Wong
2016-11-15 10:23   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 04/10] libxfs: fix xfs_attr_shortform_bytesfit declaration Darrick J. Wong
2016-11-15 10:23   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 05/10] libxfs: clean up _dir2_data_freescan Darrick J. Wong
2016-11-15 10:24   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 06/10] xfs: don't call xfs_sb_quota_from_disk twice Eric Sandeen
2016-11-15 10:24   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 07/10] xfs: defer should abort intent items if the trans roll fails Darrick J. Wong
2016-11-15 10:24   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 08/10] xfs: move dir_ino_validate declaration per xfsprogs Darrick J. Wong
2016-11-15 10:25   ` Christoph Hellwig
2016-11-05  0:10 ` [PATCH 09/10] xfs: check return value of _trans_reserve_quota_nblks Darrick J. Wong
2016-11-15 10:25   ` Christoph Hellwig
2016-11-05  0:10 ` Darrick J. Wong [this message]
2016-11-15 10:25   ` [PATCH 10/10] xfs: check minimum block size for CRC filesystems Christoph Hellwig

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=147830465785.27129.17151401159795461152.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.