diff options
author | David Chinner <dgc@sgi.com> | 2008-04-09 22:22:17 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 22:00:24 -0400 |
commit | d64e31a2f53cdcb2f95b782196faacb0995ca0c0 (patch) | |
tree | d13230aeeb739f263305c686168823e161bdf619 /fs | |
parent | 556b8b166c9514b5f940047a41dad8fe8cd9a778 (diff) |
[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: 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')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 19 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 6 |
6 files changed, 21 insertions, 26 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 1d95dca96cfe..f6dab5d8944e 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -875,28 +875,21 @@ xfs_bdstrat_cb(struct xfs_buf *bp) | |||
875 | } | 875 | } |
876 | 876 | ||
877 | /* | 877 | /* |
878 | * Wrapper around bdstrat so that we can stop data | 878 | * Wrapper around bdstrat so that we can stop data from going to disk in case |
879 | * from going to disk in case we are shutting down the filesystem. | 879 | * we are shutting down the filesystem. Typically user data goes thru this |
880 | * Typically user data goes thru this path; one of the exceptions | 880 | * path; one of the exceptions is the superblock. |
881 | * is the superblock. | ||
882 | */ | 881 | */ |
883 | int | 882 | void |
884 | xfsbdstrat( | 883 | xfsbdstrat( |
885 | struct xfs_mount *mp, | 884 | struct xfs_mount *mp, |
886 | struct xfs_buf *bp) | 885 | struct xfs_buf *bp) |
887 | { | 886 | { |
888 | ASSERT(mp); | 887 | ASSERT(mp); |
889 | if (!XFS_FORCED_SHUTDOWN(mp)) { | 888 | if (!XFS_FORCED_SHUTDOWN(mp)) |
890 | /* Grio redirection would go here | ||
891 | * if (XFS_BUF_IS_GRIO(bp)) { | ||
892 | */ | ||
893 | |||
894 | xfs_buf_iorequest(bp); | 889 | xfs_buf_iorequest(bp); |
895 | return 0; | ||
896 | } | ||
897 | 890 | ||
898 | xfs_buftrace("XFSBDSTRAT IOERROR", bp); | 891 | xfs_buftrace("XFSBDSTRAT IOERROR", bp); |
899 | return (xfs_bioerror_relse(bp)); | 892 | xfs_bioerror_relse(bp); |
900 | } | 893 | } |
901 | 894 | ||
902 | /* | 895 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h index e200253139cf..e1d498b4ba7a 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.h +++ b/fs/xfs/linux-2.6/xfs_lrw.h | |||
@@ -68,7 +68,8 @@ extern void xfs_inval_cached_trace(struct xfs_inode *, | |||
68 | #define xfs_inval_cached_trace(ip, offset, len, first, last) | 68 | #define xfs_inval_cached_trace(ip, offset, len, first, last) |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); | 71 | /* errors from xfsbdstrat() must be extracted from the buffer */ |
72 | extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); | ||
72 | extern int xfs_bdstrat_cb(struct xfs_buf *); | 73 | extern int xfs_bdstrat_cb(struct xfs_buf *); |
73 | extern int xfs_dev_is_read_only(struct xfs_mount *, char *); | 74 | extern int xfs_dev_is_read_only(struct xfs_mount *, char *); |
74 | 75 | ||
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 3a8fe7bfa2af..1f83298f90aa 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -121,7 +121,8 @@ xlog_bread( | |||
121 | XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); | 121 | XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); |
122 | 122 | ||
123 | xfsbdstrat(log->l_mp, bp); | 123 | xfsbdstrat(log->l_mp, bp); |
124 | if ((error = xfs_iowait(bp))) | 124 | error = xfs_iowait(bp); |
125 | if (error) | ||
125 | xfs_ioerror_alert("xlog_bread", log->l_mp, | 126 | xfs_ioerror_alert("xlog_bread", log->l_mp, |
126 | bp, XFS_BUF_ADDR(bp)); | 127 | bp, XFS_BUF_ADDR(bp)); |
127 | return error; | 128 | return error; |
@@ -3849,7 +3850,8 @@ xlog_do_recover( | |||
3849 | XFS_BUF_READ(bp); | 3850 | XFS_BUF_READ(bp); |
3850 | XFS_BUF_UNASYNC(bp); | 3851 | XFS_BUF_UNASYNC(bp); |
3851 | xfsbdstrat(log->l_mp, bp); | 3852 | xfsbdstrat(log->l_mp, bp); |
3852 | if ((error = xfs_iowait(bp))) { | 3853 | error = xfs_iowait(bp); |
3854 | if (error) { | ||
3853 | xfs_ioerror_alert("xlog_do_recover", | 3855 | xfs_ioerror_alert("xlog_do_recover", |
3854 | log->l_mp, bp, XFS_BUF_ADDR(bp)); | 3856 | log->l_mp, bp, XFS_BUF_ADDR(bp)); |
3855 | ASSERT(0); | 3857 | ASSERT(0); |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 2d03fe194c2c..2fec452afbcc 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1470,7 +1470,6 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) | |||
1470 | XFS_BUF_UNASYNC(sbp); | 1470 | XFS_BUF_UNASYNC(sbp); |
1471 | ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); | 1471 | ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); |
1472 | xfsbdstrat(mp, sbp); | 1472 | xfsbdstrat(mp, sbp); |
1473 | /* Nevermind errors we might get here. */ | ||
1474 | error = xfs_iowait(sbp); | 1473 | error = xfs_iowait(sbp); |
1475 | if (error) | 1474 | if (error) |
1476 | xfs_ioerror_alert("xfs_unmountfs_writesb", | 1475 | xfs_ioerror_alert("xfs_unmountfs_writesb", |
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 4e5c010f5040..cb0c5839154b 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -354,17 +354,15 @@ xfs_trans_read_buf( | |||
354 | ASSERT(!XFS_BUF_ISASYNC(bp)); | 354 | ASSERT(!XFS_BUF_ISASYNC(bp)); |
355 | XFS_BUF_READ(bp); | 355 | XFS_BUF_READ(bp); |
356 | xfsbdstrat(tp->t_mountp, bp); | 356 | xfsbdstrat(tp->t_mountp, bp); |
357 | xfs_iowait(bp); | 357 | error = xfs_iowait(bp); |
358 | if (XFS_BUF_GETERROR(bp) != 0) { | 358 | if (error) { |
359 | xfs_ioerror_alert("xfs_trans_read_buf", mp, | 359 | xfs_ioerror_alert("xfs_trans_read_buf", mp, |
360 | bp, blkno); | 360 | bp, blkno); |
361 | error = XFS_BUF_GETERROR(bp); | ||
362 | xfs_buf_relse(bp); | 361 | xfs_buf_relse(bp); |
363 | /* | 362 | /* |
364 | * We can gracefully recover from most | 363 | * We can gracefully recover from most read |
365 | * read errors. Ones we can't are those | 364 | * errors. Ones we can't are those that happen |
366 | * that happen after the transaction's | 365 | * after the transaction's already dirty. |
367 | * already dirty. | ||
368 | */ | 366 | */ |
369 | if (tp->t_flags & XFS_TRANS_DIRTY) | 367 | if (tp->t_flags & XFS_TRANS_DIRTY) |
370 | xfs_force_shutdown(tp->t_mountp, | 368 | xfs_force_shutdown(tp->t_mountp, |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index ca38fb9a9937..dd4621e0ab3b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -3825,7 +3825,8 @@ xfs_zero_remaining_bytes( | |||
3825 | XFS_BUF_READ(bp); | 3825 | XFS_BUF_READ(bp); |
3826 | XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock)); | 3826 | XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock)); |
3827 | xfsbdstrat(mp, bp); | 3827 | xfsbdstrat(mp, bp); |
3828 | if ((error = xfs_iowait(bp))) { | 3828 | error = xfs_iowait(bp); |
3829 | if (error) { | ||
3829 | xfs_ioerror_alert("xfs_zero_remaining_bytes(read)", | 3830 | xfs_ioerror_alert("xfs_zero_remaining_bytes(read)", |
3830 | mp, bp, XFS_BUF_ADDR(bp)); | 3831 | mp, bp, XFS_BUF_ADDR(bp)); |
3831 | break; | 3832 | break; |
@@ -3837,7 +3838,8 @@ xfs_zero_remaining_bytes( | |||
3837 | XFS_BUF_UNREAD(bp); | 3838 | XFS_BUF_UNREAD(bp); |
3838 | XFS_BUF_WRITE(bp); | 3839 | XFS_BUF_WRITE(bp); |
3839 | xfsbdstrat(mp, bp); | 3840 | xfsbdstrat(mp, bp); |
3840 | if ((error = xfs_iowait(bp))) { | 3841 | error = xfs_iowait(bp); |
3842 | if (error) { | ||
3841 | xfs_ioerror_alert("xfs_zero_remaining_bytes(write)", | 3843 | xfs_ioerror_alert("xfs_zero_remaining_bytes(write)", |
3842 | mp, bp, XFS_BUF_ADDR(bp)); | 3844 | mp, bp, XFS_BUF_ADDR(bp)); |
3843 | break; | 3845 | break; |