提交 fc6149d8 编写于 作者: D David Chinner 提交者: Lachlan McIlroy

[XFS] Check for xfs_free_extent() failing.

xfs_free_extent() can fail, but log recovery never bothers to check if it
successfully free the extent it was supposed to. This could lead to silent
corruption during log recovery. Abort log recovery if we fail to free an
extent.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30801a
Signed-off-by: NDavid Chinner <dgc@sgi.com>
Signed-off-by: NNiv Sardi <xaiki@sgi.com>
Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
上级 d87dd636
...@@ -3003,15 +3003,15 @@ xlog_recover_process_efi( ...@@ -3003,15 +3003,15 @@ xlog_recover_process_efi(
tp = xfs_trans_alloc(mp, 0); tp = xfs_trans_alloc(mp, 0);
error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0, 0, 0); error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0, 0, 0);
if (error) { if (error)
xfs_trans_cancel(tp, XFS_TRANS_ABORT); goto abort_error;
return error;
}
efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents); efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
for (i = 0; i < efip->efi_format.efi_nextents; i++) { for (i = 0; i < efip->efi_format.efi_nextents; i++) {
extp = &(efip->efi_format.efi_extents[i]); extp = &(efip->efi_format.efi_extents[i]);
xfs_free_extent(tp, extp->ext_start, extp->ext_len); error = xfs_free_extent(tp, extp->ext_start, extp->ext_len);
if (error)
goto abort_error;
xfs_trans_log_efd_extent(tp, efdp, extp->ext_start, xfs_trans_log_efd_extent(tp, efdp, extp->ext_start,
extp->ext_len); extp->ext_len);
} }
...@@ -3019,6 +3019,10 @@ xlog_recover_process_efi( ...@@ -3019,6 +3019,10 @@ xlog_recover_process_efi(
efip->efi_flags |= XFS_EFI_RECOVERED; efip->efi_flags |= XFS_EFI_RECOVERED;
error = xfs_trans_commit(tp, 0); error = xfs_trans_commit(tp, 0);
return error; return error;
abort_error:
xfs_trans_cancel(tp, XFS_TRANS_ABORT);
return error;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册