Commit 234f56ac authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy

[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: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarNiv Sardi <xaiki@sgi.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent 78e9da77
...@@ -1162,10 +1162,14 @@ xlog_write_log_records( ...@@ -1162,10 +1162,14 @@ xlog_write_log_records(
if (j == 0 && (start_block + endcount > ealign)) { if (j == 0 && (start_block + endcount > ealign)) {
offset = XFS_BUF_PTR(bp); offset = XFS_BUF_PTR(bp);
balign = BBTOB(ealign - start_block); balign = BBTOB(ealign - start_block);
XFS_BUF_SET_PTR(bp, offset + balign, BBTOB(sectbb)); error = XFS_BUF_SET_PTR(bp, offset + balign,
if ((error = xlog_bread(log, ealign, sectbb, bp))) BBTOB(sectbb));
if (!error)
error = xlog_bread(log, ealign, sectbb, bp);
if (!error)
error = XFS_BUF_SET_PTR(bp, offset, bufblks);
if (error)
break; break;
XFS_BUF_SET_PTR(bp, offset, bufblks);
} }
offset = xlog_align(log, start_block, endcount, bp); offset = xlog_align(log, start_block, endcount, bp);
...@@ -3630,15 +3634,19 @@ xlog_do_recovery_pass( ...@@ -3630,15 +3634,19 @@ xlog_do_recovery_pass(
* _first_, then the log start (LR header end) * _first_, then the log start (LR header end)
* - order is important. * - order is important.
*/ */
wrapped_hblks = hblks - split_hblks;
bufaddr = XFS_BUF_PTR(hbp); bufaddr = XFS_BUF_PTR(hbp);
XFS_BUF_SET_PTR(hbp, error = XFS_BUF_SET_PTR(hbp,
bufaddr + BBTOB(split_hblks), bufaddr + BBTOB(split_hblks),
BBTOB(hblks - split_hblks)); BBTOB(hblks - split_hblks));
wrapped_hblks = hblks - split_hblks; if (!error)
error = xlog_bread(log, 0, wrapped_hblks, hbp); error = xlog_bread(log, 0,
wrapped_hblks, hbp);
if (!error)
error = XFS_BUF_SET_PTR(hbp, bufaddr,
BBTOB(hblks));
if (error) if (error)
goto bread_err2; goto bread_err2;
XFS_BUF_SET_PTR(hbp, bufaddr, BBTOB(hblks));
if (!offset) if (!offset)
offset = xlog_align(log, 0, offset = xlog_align(log, 0,
wrapped_hblks, hbp); wrapped_hblks, hbp);
...@@ -3690,13 +3698,18 @@ xlog_do_recovery_pass( ...@@ -3690,13 +3698,18 @@ xlog_do_recovery_pass(
* - order is important. * - order is important.
*/ */
bufaddr = XFS_BUF_PTR(dbp); bufaddr = XFS_BUF_PTR(dbp);
XFS_BUF_SET_PTR(dbp, error = XFS_BUF_SET_PTR(dbp,
bufaddr + BBTOB(split_bblks), bufaddr + BBTOB(split_bblks),
BBTOB(bblks - split_bblks)); BBTOB(bblks - split_bblks));
if ((error = xlog_bread(log, wrapped_hblks, if (!error)
bblks - split_bblks, dbp))) error = xlog_bread(log, wrapped_hblks,
bblks - split_bblks,
dbp);
if (!error)
error = XFS_BUF_SET_PTR(dbp, bufaddr,
h_size);
if (error)
goto bread_err2; goto bread_err2;
XFS_BUF_SET_PTR(dbp, bufaddr, h_size);
if (!offset) if (!offset)
offset = xlog_align(log, wrapped_hblks, offset = xlog_align(log, wrapped_hblks,
bblks - split_bblks, dbp); bblks - split_bblks, dbp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment