diff options
author | David Chinner <dgc@sgi.com> | 2008-04-09 22:24:24 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 22:02:10 -0400 |
commit | 234f56aca20a4f66b6ba3d3bf2787634dd9e0999 (patch) | |
tree | 5830e04df2a24cf988ad22abe960fd45fb8a5850 | |
parent | 78e9da77f1bf265fe750b9223ec15707473fb6e8 (diff) |
[XFS] Check for errors when changing buffer pointers.
xfs_buf_associate_memory() can fail, but the return is never checked.
Propagate the error through XFS_BUF_SET_PTR() so that failures are
detected.
SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30831a
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index a8039431b86f..e65ab4af0955 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -1162,10 +1162,14 @@ xlog_write_log_records( | |||
1162 | if (j == 0 && (start_block + endcount > ealign)) { | 1162 | if (j == 0 && (start_block + endcount > ealign)) { |
1163 | offset = XFS_BUF_PTR(bp); | 1163 | offset = XFS_BUF_PTR(bp); |
1164 | balign = BBTOB(ealign - start_block); | 1164 | balign = BBTOB(ealign - start_block); |
1165 | XFS_BUF_SET_PTR(bp, offset + balign, BBTOB(sectbb)); | 1165 | error = XFS_BUF_SET_PTR(bp, offset + balign, |
1166 | if ((error = xlog_bread(log, ealign, sectbb, bp))) | 1166 | BBTOB(sectbb)); |
1167 | if (!error) | ||
1168 | error = xlog_bread(log, ealign, sectbb, bp); | ||
1169 | if (!error) | ||
1170 | error = XFS_BUF_SET_PTR(bp, offset, bufblks); | ||
1171 | if (error) | ||
1167 | break; | 1172 | break; |
1168 | XFS_BUF_SET_PTR(bp, offset, bufblks); | ||
1169 | } | 1173 | } |
1170 | 1174 | ||
1171 | offset = xlog_align(log, start_block, endcount, bp); | 1175 | offset = xlog_align(log, start_block, endcount, bp); |
@@ -3630,15 +3634,19 @@ xlog_do_recovery_pass( | |||
3630 | * _first_, then the log start (LR header end) | 3634 | * _first_, then the log start (LR header end) |
3631 | * - order is important. | 3635 | * - order is important. |
3632 | */ | 3636 | */ |
3637 | wrapped_hblks = hblks - split_hblks; | ||
3633 | bufaddr = XFS_BUF_PTR(hbp); | 3638 | bufaddr = XFS_BUF_PTR(hbp); |
3634 | XFS_BUF_SET_PTR(hbp, | 3639 | error = XFS_BUF_SET_PTR(hbp, |
3635 | bufaddr + BBTOB(split_hblks), | 3640 | bufaddr + BBTOB(split_hblks), |
3636 | BBTOB(hblks - split_hblks)); | 3641 | BBTOB(hblks - split_hblks)); |
3637 | wrapped_hblks = hblks - split_hblks; | 3642 | if (!error) |
3638 | error = xlog_bread(log, 0, wrapped_hblks, hbp); | 3643 | error = xlog_bread(log, 0, |
3644 | wrapped_hblks, hbp); | ||
3645 | if (!error) | ||
3646 | error = XFS_BUF_SET_PTR(hbp, bufaddr, | ||
3647 | BBTOB(hblks)); | ||
3639 | if (error) | 3648 | if (error) |
3640 | goto bread_err2; | 3649 | goto bread_err2; |
3641 | XFS_BUF_SET_PTR(hbp, bufaddr, BBTOB(hblks)); | ||
3642 | if (!offset) | 3650 | if (!offset) |
3643 | offset = xlog_align(log, 0, | 3651 | offset = xlog_align(log, 0, |
3644 | wrapped_hblks, hbp); | 3652 | wrapped_hblks, hbp); |
@@ -3690,13 +3698,18 @@ xlog_do_recovery_pass( | |||
3690 | * - order is important. | 3698 | * - order is important. |
3691 | */ | 3699 | */ |
3692 | bufaddr = XFS_BUF_PTR(dbp); | 3700 | bufaddr = XFS_BUF_PTR(dbp); |
3693 | XFS_BUF_SET_PTR(dbp, | 3701 | error = XFS_BUF_SET_PTR(dbp, |
3694 | bufaddr + BBTOB(split_bblks), | 3702 | bufaddr + BBTOB(split_bblks), |
3695 | BBTOB(bblks - split_bblks)); | 3703 | BBTOB(bblks - split_bblks)); |
3696 | if ((error = xlog_bread(log, wrapped_hblks, | 3704 | if (!error) |
3697 | bblks - split_bblks, dbp))) | 3705 | error = xlog_bread(log, wrapped_hblks, |
3706 | bblks - split_bblks, | ||
3707 | dbp); | ||
3708 | if (!error) | ||
3709 | error = XFS_BUF_SET_PTR(dbp, bufaddr, | ||
3710 | h_size); | ||
3711 | if (error) | ||
3698 | goto bread_err2; | 3712 | goto bread_err2; |
3699 | XFS_BUF_SET_PTR(dbp, bufaddr, h_size); | ||
3700 | if (!offset) | 3713 | if (!offset) |
3701 | offset = xlog_align(log, wrapped_hblks, | 3714 | offset = xlog_align(log, wrapped_hblks, |
3702 | bblks - split_bblks, dbp); | 3715 | bblks - split_bblks, dbp); |