aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2015-05-28 19:06:30 -0400
committerDave Chinner <david@fromorbit.com>2015-05-28 19:06:30 -0400
commit7f43c907ad5afe100772249a79fa8cc9b751b28a (patch)
treecf81c5102a6f109583714cf4e48246462c03d482 /fs/xfs/xfs_log_recover.c
parent463958af5c92d876fd2fe3c756f18bd0ce70b713 (diff)
xfs: handle sparse inode chunks in icreate log recovery
Recovery of icreate transactions assumes hardcoded values for the inode count and chunk length. Sparse inode chunks are allocated in units of m_ialloc_min_blks. Update the icreate validity checks to allow for appropriately sized inode chunks and verify the inode count matches what is expected based on the extent length rather than assuming a hardcoded count. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 8abfd7881d8a..4a8c440b6280 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3068,12 +3068,22 @@ xlog_recover_do_icreate_pass2(
3068 return -EINVAL; 3068 return -EINVAL;
3069 } 3069 }
3070 3070
3071 /* existing allocation is fixed value */ 3071 /*
3072 ASSERT(count == mp->m_ialloc_inos); 3072 * The inode chunk is either full or sparse and we only support
3073 ASSERT(length == mp->m_ialloc_blks); 3073 * m_ialloc_min_blks sized sparse allocations at this time.
3074 if (count != mp->m_ialloc_inos || 3074 */
3075 length != mp->m_ialloc_blks) { 3075 if (length != mp->m_ialloc_blks &&
3076 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad count 2"); 3076 length != mp->m_ialloc_min_blks) {
3077 xfs_warn(log->l_mp,
3078 "%s: unsupported chunk length", __FUNCTION__);
3079 return -EINVAL;
3080 }
3081
3082 /* verify inode count is consistent with extent length */
3083 if ((count >> mp->m_sb.sb_inopblog) != length) {
3084 xfs_warn(log->l_mp,
3085 "%s: inconsistent inode count and chunk length",
3086 __FUNCTION__);
3077 return -EINVAL; 3087 return -EINVAL;
3078 } 3088 }
3079 3089