aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-04-03 01:11:32 -0400
committerBen Myers <bpm@sgi.com>2013-04-27 14:05:18 -0400
commite721f504cf46a0c84741ba2137d7a052d79436db (patch)
treedd9d92321068cab132cecebc4abb9c6489e36986 /fs/xfs/xfs_mount.c
parent04a1e6c5b222b089c6960dfc5352002002a4355f (diff)
xfs: implement extended feature masks
The version 5 superblock has extended feature masks for compatible, incompatible and read-only compatible feature sets. Implement the masking and mount-time checking for these feature masks. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r--fs/xfs/xfs_mount.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 140136cf2dc0..f6bfbd734669 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -114,7 +114,9 @@ static const struct {
114 { offsetof(xfs_sb_t, sb_features_compat), 0 }, 114 { offsetof(xfs_sb_t, sb_features_compat), 0 },
115 { offsetof(xfs_sb_t, sb_features_ro_compat), 0 }, 115 { offsetof(xfs_sb_t, sb_features_ro_compat), 0 },
116 { offsetof(xfs_sb_t, sb_features_incompat), 0 }, 116 { offsetof(xfs_sb_t, sb_features_incompat), 0 },
117 { offsetof(xfs_sb_t, sb_features_log_incompat), 0 },
117 { offsetof(xfs_sb_t, sb_crc), 0 }, 118 { offsetof(xfs_sb_t, sb_crc), 0 },
119 { offsetof(xfs_sb_t, sb_pad), 0 },
118 { offsetof(xfs_sb_t, sb_pquotino), 0 }, 120 { offsetof(xfs_sb_t, sb_pquotino), 0 },
119 { offsetof(xfs_sb_t, sb_lsn), 0 }, 121 { offsetof(xfs_sb_t, sb_lsn), 0 },
120 { sizeof(xfs_sb_t), 0 } 122 { sizeof(xfs_sb_t), 0 }
@@ -334,14 +336,45 @@ xfs_mount_validate_sb(
334 } 336 }
335 337
336 /* 338 /*
337 * Do not allow Version 5 superblocks to mount right now, even though 339 * Version 5 superblock feature mask validation. Reject combinations the
338 * support is in place. We need to implement the proper feature masks 340 * kernel cannot support up front before checking anything else.
339 * first.
340 */ 341 */
341 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) { 342 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) {
342 xfs_alert(mp, 343 xfs_alert(mp,
343 "Version 5 superblock detected. Experimental support not yet enabled!"); 344"Version 5 superblock detected. This kernel has EXPERIMENTAL support enabled!\n"
344 return XFS_ERROR(EINVAL); 345"Use of these features in this kernel is at your own risk!");
346
347 if (xfs_sb_has_compat_feature(sbp,
348 XFS_SB_FEAT_COMPAT_UNKNOWN)) {
349 xfs_warn(mp,
350"Superblock has unknown compatible features (0x%x) enabled.\n"
351"Using a more recent kernel is recommended.",
352 (sbp->sb_features_compat &
353 XFS_SB_FEAT_COMPAT_UNKNOWN));
354 }
355
356 if (xfs_sb_has_ro_compat_feature(sbp,
357 XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
358 xfs_alert(mp,
359"Superblock has unknown read-only compatible features (0x%x) enabled.",
360 (sbp->sb_features_ro_compat &
361 XFS_SB_FEAT_RO_COMPAT_UNKNOWN));
362 if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
363 xfs_warn(mp,
364"Attempted to mount read-only compatible filesystem read-write.\n"
365"Filesystem can only be safely mounted read only.");
366 return XFS_ERROR(EINVAL);
367 }
368 }
369 if (xfs_sb_has_incompat_feature(sbp,
370 XFS_SB_FEAT_INCOMPAT_UNKNOWN)) {
371 xfs_warn(mp,
372"Superblock has unknown incompatible features (0x%x) enabled.\n"
373"Filesystem can not be safely mounted by this kernel.",
374 (sbp->sb_features_incompat &
375 XFS_SB_FEAT_INCOMPAT_UNKNOWN));
376 return XFS_ERROR(EINVAL);
377 }
345 } 378 }
346 379
347 if (unlikely( 380 if (unlikely(
@@ -580,6 +613,9 @@ xfs_sb_from_disk(
580 to->sb_features_compat = be32_to_cpu(from->sb_features_compat); 613 to->sb_features_compat = be32_to_cpu(from->sb_features_compat);
581 to->sb_features_ro_compat = be32_to_cpu(from->sb_features_ro_compat); 614 to->sb_features_ro_compat = be32_to_cpu(from->sb_features_ro_compat);
582 to->sb_features_incompat = be32_to_cpu(from->sb_features_incompat); 615 to->sb_features_incompat = be32_to_cpu(from->sb_features_incompat);
616 to->sb_features_log_incompat =
617 be32_to_cpu(from->sb_features_log_incompat);
618 to->sb_pad = 0;
583 to->sb_pquotino = be64_to_cpu(from->sb_pquotino); 619 to->sb_pquotino = be64_to_cpu(from->sb_pquotino);
584 to->sb_lsn = be64_to_cpu(from->sb_lsn); 620 to->sb_lsn = be64_to_cpu(from->sb_lsn);
585} 621}
@@ -786,7 +822,7 @@ reread:
786 if (bp->b_error) { 822 if (bp->b_error) {
787 error = bp->b_error; 823 error = bp->b_error;
788 if (loud) 824 if (loud)
789 xfs_warn(mp, "SB validate failed"); 825 xfs_warn(mp, "SB validate failed with error %d.", error);
790 goto release_buf; 826 goto release_buf;
791 } 827 }
792 828