From: Darrick J. Wong Date: Thu, 4 Oct 2018 19:18:01 +0000 (-0500) Subject: xfs_repair: fix block reservation in mk_rsumino X-Git-Tag: v4.19.0-rc0~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1530d232c4a5364d2a81047662f3b9d0026945ed;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: fix block reservation in mk_rsumino The functions mk_rsumino and rtinit both allocate transactions to create the realtime summary inode. In order to allocate and map blocks to the rtsummary file, these transactions require a block reservation. However, despite the comments in mk_rsumino about lifting the code from mkfs, it doesn't actually copy the same reservation calculation that mkfs uses in rtinit(). Practically speaking this has no effect since userspace doesn't care about transaction block reservations, but fix this logic bomb anyway. [sandeen: tweaks to backport before libxfs updates] Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/repair/phase6.c b/repair/phase6.c index 19ad54d3e..eb59108b6 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -836,7 +836,7 @@ mk_rsumino(xfs_mount_t *mp) tres.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; error = -libxfs_trans_alloc(mp, &tres, - mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1), + nsumblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0, 0, &tp); if (error) res_failed(error);