提交 5875e058 编写于 作者: A Allison Henderson 提交者: Long Li

xfs: increase rename inode reservation

mainline inclusion
from mainline-v6.1-rc1
commit e07ee6fe
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e07ee6fe21f47cfd72ae566395c67a80e7c66163

--------------------------------

xfs_rename can update up to 5 inodes: src_dp, target_dp, src_ip, target_ip
and wip.  So we need to increase the inode reservation to match.
Signed-off-by: NAllison Henderson <allison.henderson@oracle.com>
Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NYe Bin <yebin10@huawei.com>
Signed-off-by: NLong Li <leo.lilong@huawei.com>
上级 e220e905
...@@ -330,7 +330,7 @@ xfs_calc_itruncate_reservation( ...@@ -330,7 +330,7 @@ xfs_calc_itruncate_reservation(
/* /*
* In renaming a files we can modify: * In renaming a files we can modify:
* the four inodes involved: 4 * inode size * the five inodes involved: 5 * inode size
* the two directory btrees: 2 * (max depth + v2) * dir block size * the two directory btrees: 2 * (max depth + v2) * dir block size
* the two directory bmap btrees: 2 * max depth * block size * the two directory bmap btrees: 2 * max depth * block size
* And the bmap_finish transaction can free dir and bmap blocks (two sets * And the bmap_finish transaction can free dir and bmap blocks (two sets
...@@ -345,7 +345,7 @@ xfs_calc_rename_reservation( ...@@ -345,7 +345,7 @@ xfs_calc_rename_reservation(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
return XFS_DQUOT_LOGRES(mp) + return XFS_DQUOT_LOGRES(mp) +
max((xfs_calc_inode_res(mp, 4) + max((xfs_calc_inode_res(mp, 5) +
xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp), xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
XFS_FSB_TO_B(mp, 1))), XFS_FSB_TO_B(mp, 1))),
(xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) + (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
......
...@@ -3284,7 +3284,7 @@ xfs_rename( ...@@ -3284,7 +3284,7 @@ xfs_rename(
* Lock all the participating inodes. Depending upon whether * Lock all the participating inodes. Depending upon whether
* the target_name exists in the target directory, and * the target_name exists in the target directory, and
* whether the target directory is the same as the source * whether the target directory is the same as the source
* directory, we can lock from 2 to 4 inodes. * directory, we can lock from 2 to 5 inodes.
*/ */
xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL); xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册