aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
authorDavid Chinner <dgc@sgi.com>2008-04-09 22:21:53 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-04-17 21:59:23 -0400
commitfc6149d8d9634814cdcd9283b8f2efd3359181df (patch)
tree601c3ad274aae19a264009a385b8eb95977ada9a /fs/xfs/xfs_log_recover.c
parentd87dd6360dce86cad9099aed74f14b4dd0143301 (diff)
[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: David Chinner <dgc@sgi.com> Signed-off-by: Niv Sardi <xaiki@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 418582b709eb..3a8fe7bfa2af 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3003,15 +3003,15 @@ xlog_recover_process_efi(
3003 3003
3004 tp = xfs_trans_alloc(mp, 0); 3004 tp = xfs_trans_alloc(mp, 0);
3005 error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0, 0, 0); 3005 error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0, 0, 0);
3006 if (error) { 3006 if (error)
3007 xfs_trans_cancel(tp, XFS_TRANS_ABORT); 3007 goto abort_error;
3008 return error;
3009 }
3010 efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents); 3008 efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
3011 3009
3012 for (i = 0; i < efip->efi_format.efi_nextents; i++) { 3010 for (i = 0; i < efip->efi_format.efi_nextents; i++) {
3013 extp = &(efip->efi_format.efi_extents[i]); 3011 extp = &(efip->efi_format.efi_extents[i]);
3014 xfs_free_extent(tp, extp->ext_start, extp->ext_len); 3012 error = xfs_free_extent(tp, extp->ext_start, extp->ext_len);
3013 if (error)
3014 goto abort_error;
3015 xfs_trans_log_efd_extent(tp, efdp, extp->ext_start, 3015 xfs_trans_log_efd_extent(tp, efdp, extp->ext_start,
3016 extp->ext_len); 3016 extp->ext_len);
3017 } 3017 }
@@ -3019,6 +3019,10 @@ xlog_recover_process_efi(
3019 efip->efi_flags |= XFS_EFI_RECOVERED; 3019 efip->efi_flags |= XFS_EFI_RECOVERED;
3020 error = xfs_trans_commit(tp, 0); 3020 error = xfs_trans_commit(tp, 0);
3021 return error; 3021 return error;
3022
3023abort_error:
3024 xfs_trans_cancel(tp, XFS_TRANS_ABORT);
3025 return error;
3022} 3026}
3023 3027
3024/* 3028/*