diff options
author | Christoph Hellwig <hch@lst.de> | 2009-01-18 20:04:07 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-01-18 20:04:07 -0500 |
commit | 7884bc8617e6b8afda8cb8853cf14abfd3148d5c (patch) | |
tree | eccabfabb65cfc06402f4c23f813bf84b500b5a3 /fs/xfs/xfs_mount.c | |
parent | 98b8c7a0c42acf0d6963dbb9aabe4a2e312aae12 (diff) |
xfs: fix bad_features2 fixups for the root filesystem
Currently the bad_features2 fixup and the alignment updates in the superblock
are skipped if we mount a filesystem read-only. But for the root filesystem
the typical case is to mount read-only first and only later remount writeable
so we'll never perform this update at all. It's not a big problem but means
the logs of people needing the fixup get spammed at every boot because they
never happen on disk.
Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 3c97c6463a4e..35300250e86d 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include "xfs_fsops.h" | 45 | #include "xfs_fsops.h" |
46 | #include "xfs_utils.h" | 46 | #include "xfs_utils.h" |
47 | 47 | ||
48 | STATIC int xfs_mount_log_sb(xfs_mount_t *, __int64_t); | ||
49 | STATIC int xfs_uuid_mount(xfs_mount_t *); | 48 | STATIC int xfs_uuid_mount(xfs_mount_t *); |
50 | STATIC void xfs_unmountfs_wait(xfs_mount_t *); | 49 | STATIC void xfs_unmountfs_wait(xfs_mount_t *); |
51 | 50 | ||
@@ -682,7 +681,7 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount) | |||
682 | * Update alignment values based on mount options and sb values | 681 | * Update alignment values based on mount options and sb values |
683 | */ | 682 | */ |
684 | STATIC int | 683 | STATIC int |
685 | xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags) | 684 | xfs_update_alignment(xfs_mount_t *mp) |
686 | { | 685 | { |
687 | xfs_sb_t *sbp = &(mp->m_sb); | 686 | xfs_sb_t *sbp = &(mp->m_sb); |
688 | 687 | ||
@@ -736,11 +735,11 @@ xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags) | |||
736 | if (xfs_sb_version_hasdalign(sbp)) { | 735 | if (xfs_sb_version_hasdalign(sbp)) { |
737 | if (sbp->sb_unit != mp->m_dalign) { | 736 | if (sbp->sb_unit != mp->m_dalign) { |
738 | sbp->sb_unit = mp->m_dalign; | 737 | sbp->sb_unit = mp->m_dalign; |
739 | *update_flags |= XFS_SB_UNIT; | 738 | mp->m_update_flags |= XFS_SB_UNIT; |
740 | } | 739 | } |
741 | if (sbp->sb_width != mp->m_swidth) { | 740 | if (sbp->sb_width != mp->m_swidth) { |
742 | sbp->sb_width = mp->m_swidth; | 741 | sbp->sb_width = mp->m_swidth; |
743 | *update_flags |= XFS_SB_WIDTH; | 742 | mp->m_update_flags |= XFS_SB_WIDTH; |
744 | } | 743 | } |
745 | } | 744 | } |
746 | } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && | 745 | } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && |
@@ -905,7 +904,6 @@ xfs_mountfs( | |||
905 | xfs_sb_t *sbp = &(mp->m_sb); | 904 | xfs_sb_t *sbp = &(mp->m_sb); |
906 | xfs_inode_t *rip; | 905 | xfs_inode_t *rip; |
907 | __uint64_t resblks; | 906 | __uint64_t resblks; |
908 | __int64_t update_flags = 0LL; | ||
909 | uint quotamount, quotaflags; | 907 | uint quotamount, quotaflags; |
910 | int uuid_mounted = 0; | 908 | int uuid_mounted = 0; |
911 | int error = 0; | 909 | int error = 0; |
@@ -933,7 +931,7 @@ xfs_mountfs( | |||
933 | "XFS: correcting sb_features alignment problem"); | 931 | "XFS: correcting sb_features alignment problem"); |
934 | sbp->sb_features2 |= sbp->sb_bad_features2; | 932 | sbp->sb_features2 |= sbp->sb_bad_features2; |
935 | sbp->sb_bad_features2 = sbp->sb_features2; | 933 | sbp->sb_bad_features2 = sbp->sb_features2; |
936 | update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2; | 934 | mp->m_update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2; |
937 | 935 | ||
938 | /* | 936 | /* |
939 | * Re-check for ATTR2 in case it was found in bad_features2 | 937 | * Re-check for ATTR2 in case it was found in bad_features2 |
@@ -947,11 +945,11 @@ xfs_mountfs( | |||
947 | if (xfs_sb_version_hasattr2(&mp->m_sb) && | 945 | if (xfs_sb_version_hasattr2(&mp->m_sb) && |
948 | (mp->m_flags & XFS_MOUNT_NOATTR2)) { | 946 | (mp->m_flags & XFS_MOUNT_NOATTR2)) { |
949 | xfs_sb_version_removeattr2(&mp->m_sb); | 947 | xfs_sb_version_removeattr2(&mp->m_sb); |
950 | update_flags |= XFS_SB_FEATURES2; | 948 | mp->m_update_flags |= XFS_SB_FEATURES2; |
951 | 949 | ||
952 | /* update sb_versionnum for the clearing of the morebits */ | 950 | /* update sb_versionnum for the clearing of the morebits */ |
953 | if (!sbp->sb_features2) | 951 | if (!sbp->sb_features2) |
954 | update_flags |= XFS_SB_VERSIONNUM; | 952 | mp->m_update_flags |= XFS_SB_VERSIONNUM; |
955 | } | 953 | } |
956 | 954 | ||
957 | /* | 955 | /* |
@@ -960,7 +958,7 @@ xfs_mountfs( | |||
960 | * allocator alignment is within an ag, therefore ag has | 958 | * allocator alignment is within an ag, therefore ag has |
961 | * to be aligned at stripe boundary. | 959 | * to be aligned at stripe boundary. |
962 | */ | 960 | */ |
963 | error = xfs_update_alignment(mp, &update_flags); | 961 | error = xfs_update_alignment(mp); |
964 | if (error) | 962 | if (error) |
965 | goto error1; | 963 | goto error1; |
966 | 964 | ||
@@ -1137,10 +1135,12 @@ xfs_mountfs( | |||
1137 | } | 1135 | } |
1138 | 1136 | ||
1139 | /* | 1137 | /* |
1140 | * If fs is not mounted readonly, then update the superblock changes. | 1138 | * If this is a read-only mount defer the superblock updates until |
1139 | * the next remount into writeable mode. Otherwise we would never | ||
1140 | * perform the update e.g. for the root filesystem. | ||
1141 | */ | 1141 | */ |
1142 | if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) { | 1142 | if (mp->m_update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) { |
1143 | error = xfs_mount_log_sb(mp, update_flags); | 1143 | error = xfs_mount_log_sb(mp, mp->m_update_flags); |
1144 | if (error) { | 1144 | if (error) { |
1145 | cmn_err(CE_WARN, "XFS: failed to write sb changes"); | 1145 | cmn_err(CE_WARN, "XFS: failed to write sb changes"); |
1146 | goto error4; | 1146 | goto error4; |
@@ -1820,7 +1820,7 @@ xfs_uuid_mount( | |||
1820 | * be altered by the mount options, as well as any potential sb_features2 | 1820 | * be altered by the mount options, as well as any potential sb_features2 |
1821 | * fixup. Only the first superblock is updated. | 1821 | * fixup. Only the first superblock is updated. |
1822 | */ | 1822 | */ |
1823 | STATIC int | 1823 | int |
1824 | xfs_mount_log_sb( | 1824 | xfs_mount_log_sb( |
1825 | xfs_mount_t *mp, | 1825 | xfs_mount_t *mp, |
1826 | __int64_t fields) | 1826 | __int64_t fields) |