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

[XFS] Ensure errors from xfs_bdstrat() are correctly checked.

xfsbdstrat() is declared to return an error. That is never checked because
the error is propagated by the xfs_buf_t that is passed through the
function.

Mark xfsbdstrat() as returning void and comment the prototype on the
methods needed for error checking.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30823a
Signed-off-by: NDavid Chinner <dgc@sgi.com>
Signed-off-by: NNiv Sardi <xaiki@sgi.com>
Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
上级 556b8b16
...@@ -875,28 +875,21 @@ xfs_bdstrat_cb(struct xfs_buf *bp) ...@@ -875,28 +875,21 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
} }
/* /*
* Wrapper around bdstrat so that we can stop data * Wrapper around bdstrat so that we can stop data from going to disk in case
* from going to disk in case we are shutting down the filesystem. * we are shutting down the filesystem. Typically user data goes thru this
* Typically user data goes thru this path; one of the exceptions * path; one of the exceptions is the superblock.
* is the superblock.
*/ */
int void
xfsbdstrat( xfsbdstrat(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
ASSERT(mp); ASSERT(mp);
if (!XFS_FORCED_SHUTDOWN(mp)) { if (!XFS_FORCED_SHUTDOWN(mp))
/* Grio redirection would go here
* if (XFS_BUF_IS_GRIO(bp)) {
*/
xfs_buf_iorequest(bp); xfs_buf_iorequest(bp);
return 0;
}
xfs_buftrace("XFSBDSTRAT IOERROR", bp); xfs_buftrace("XFSBDSTRAT IOERROR", bp);
return (xfs_bioerror_relse(bp)); xfs_bioerror_relse(bp);
} }
/* /*
......
...@@ -68,7 +68,8 @@ extern void xfs_inval_cached_trace(struct xfs_inode *, ...@@ -68,7 +68,8 @@ extern void xfs_inval_cached_trace(struct xfs_inode *,
#define xfs_inval_cached_trace(ip, offset, len, first, last) #define xfs_inval_cached_trace(ip, offset, len, first, last)
#endif #endif
extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); /* errors from xfsbdstrat() must be extracted from the buffer */
extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
extern int xfs_bdstrat_cb(struct xfs_buf *); extern int xfs_bdstrat_cb(struct xfs_buf *);
extern int xfs_dev_is_read_only(struct xfs_mount *, char *); extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
......
...@@ -121,7 +121,8 @@ xlog_bread( ...@@ -121,7 +121,8 @@ xlog_bread(
XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);
xfsbdstrat(log->l_mp, bp); xfsbdstrat(log->l_mp, bp);
if ((error = xfs_iowait(bp))) error = xfs_iowait(bp);
if (error)
xfs_ioerror_alert("xlog_bread", log->l_mp, xfs_ioerror_alert("xlog_bread", log->l_mp,
bp, XFS_BUF_ADDR(bp)); bp, XFS_BUF_ADDR(bp));
return error; return error;
...@@ -3849,7 +3850,8 @@ xlog_do_recover( ...@@ -3849,7 +3850,8 @@ xlog_do_recover(
XFS_BUF_READ(bp); XFS_BUF_READ(bp);
XFS_BUF_UNASYNC(bp); XFS_BUF_UNASYNC(bp);
xfsbdstrat(log->l_mp, bp); xfsbdstrat(log->l_mp, bp);
if ((error = xfs_iowait(bp))) { error = xfs_iowait(bp);
if (error) {
xfs_ioerror_alert("xlog_do_recover", xfs_ioerror_alert("xlog_do_recover",
log->l_mp, bp, XFS_BUF_ADDR(bp)); log->l_mp, bp, XFS_BUF_ADDR(bp));
ASSERT(0); ASSERT(0);
......
...@@ -1470,7 +1470,6 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) ...@@ -1470,7 +1470,6 @@ xfs_unmountfs_writesb(xfs_mount_t *mp)
XFS_BUF_UNASYNC(sbp); XFS_BUF_UNASYNC(sbp);
ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp);
xfsbdstrat(mp, sbp); xfsbdstrat(mp, sbp);
/* Nevermind errors we might get here. */
error = xfs_iowait(sbp); error = xfs_iowait(sbp);
if (error) if (error)
xfs_ioerror_alert("xfs_unmountfs_writesb", xfs_ioerror_alert("xfs_unmountfs_writesb",
......
...@@ -354,17 +354,15 @@ xfs_trans_read_buf( ...@@ -354,17 +354,15 @@ xfs_trans_read_buf(
ASSERT(!XFS_BUF_ISASYNC(bp)); ASSERT(!XFS_BUF_ISASYNC(bp));
XFS_BUF_READ(bp); XFS_BUF_READ(bp);
xfsbdstrat(tp->t_mountp, bp); xfsbdstrat(tp->t_mountp, bp);
xfs_iowait(bp); error = xfs_iowait(bp);
if (XFS_BUF_GETERROR(bp) != 0) { if (error) {
xfs_ioerror_alert("xfs_trans_read_buf", mp, xfs_ioerror_alert("xfs_trans_read_buf", mp,
bp, blkno); bp, blkno);
error = XFS_BUF_GETERROR(bp);
xfs_buf_relse(bp); xfs_buf_relse(bp);
/* /*
* We can gracefully recover from most * We can gracefully recover from most read
* read errors. Ones we can't are those * errors. Ones we can't are those that happen
* that happen after the transaction's * after the transaction's already dirty.
* already dirty.
*/ */
if (tp->t_flags & XFS_TRANS_DIRTY) if (tp->t_flags & XFS_TRANS_DIRTY)
xfs_force_shutdown(tp->t_mountp, xfs_force_shutdown(tp->t_mountp,
......
...@@ -3825,7 +3825,8 @@ xfs_zero_remaining_bytes( ...@@ -3825,7 +3825,8 @@ xfs_zero_remaining_bytes(
XFS_BUF_READ(bp); XFS_BUF_READ(bp);
XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock)); XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock));
xfsbdstrat(mp, bp); xfsbdstrat(mp, bp);
if ((error = xfs_iowait(bp))) { error = xfs_iowait(bp);
if (error) {
xfs_ioerror_alert("xfs_zero_remaining_bytes(read)", xfs_ioerror_alert("xfs_zero_remaining_bytes(read)",
mp, bp, XFS_BUF_ADDR(bp)); mp, bp, XFS_BUF_ADDR(bp));
break; break;
...@@ -3837,7 +3838,8 @@ xfs_zero_remaining_bytes( ...@@ -3837,7 +3838,8 @@ xfs_zero_remaining_bytes(
XFS_BUF_UNREAD(bp); XFS_BUF_UNREAD(bp);
XFS_BUF_WRITE(bp); XFS_BUF_WRITE(bp);
xfsbdstrat(mp, bp); xfsbdstrat(mp, bp);
if ((error = xfs_iowait(bp))) { error = xfs_iowait(bp);
if (error) {
xfs_ioerror_alert("xfs_zero_remaining_bytes(write)", xfs_ioerror_alert("xfs_zero_remaining_bytes(write)",
mp, bp, XFS_BUF_ADDR(bp)); mp, bp, XFS_BUF_ADDR(bp));
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册