aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_fsops.c11
-rw-r--r--fs/xfs/xfs_mount.c39
-rw-r--r--fs/xfs/xfs_rtalloc.c29
3 files changed, 34 insertions, 45 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 43b1d5699335..6a1edb1348f6 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -144,12 +144,11 @@ xfs_growfs_data_private(
144 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb))) 144 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb)))
145 return error; 145 return error;
146 dpct = pct - mp->m_sb.sb_imax_pct; 146 dpct = pct - mp->m_sb.sb_imax_pct;
147 error = xfs_read_buf(mp, mp->m_ddev_targp, 147 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
148 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), 148 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1),
149 XFS_FSS_TO_BB(mp, 1), 0, &bp); 149 BBTOB(XFS_FSS_TO_BB(mp, 1)), 0);
150 if (error) 150 if (!bp)
151 return error; 151 return EIO;
152 ASSERT(bp);
153 xfs_buf_relse(bp); 152 xfs_buf_relse(bp);
154 153
155 new = nb; /* use new as a temporary here */ 154 new = nb; /* use new as a temporary here */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index fbca293326e5..912101d280bf 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -980,42 +980,35 @@ xfs_check_sizes(xfs_mount_t *mp)
980{ 980{
981 xfs_buf_t *bp; 981 xfs_buf_t *bp;
982 xfs_daddr_t d; 982 xfs_daddr_t d;
983 int error;
984 983
985 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); 984 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
986 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { 985 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
987 cmn_err(CE_WARN, "XFS: size check 1 failed"); 986 cmn_err(CE_WARN, "XFS: filesystem size mismatch detected");
988 return XFS_ERROR(EFBIG); 987 return XFS_ERROR(EFBIG);
989 } 988 }
990 error = xfs_read_buf(mp, mp->m_ddev_targp, 989 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
991 d - XFS_FSS_TO_BB(mp, 1), 990 d - XFS_FSS_TO_BB(mp, 1),
992 XFS_FSS_TO_BB(mp, 1), 0, &bp); 991 BBTOB(XFS_FSS_TO_BB(mp, 1)), 0);
993 if (!error) { 992 if (!bp) {
994 xfs_buf_relse(bp); 993 cmn_err(CE_WARN, "XFS: last sector read failed");
995 } else { 994 return EIO;
996 cmn_err(CE_WARN, "XFS: size check 2 failed");
997 if (error == ENOSPC)
998 error = XFS_ERROR(EFBIG);
999 return error;
1000 } 995 }
996 xfs_buf_relse(bp);
1001 997
1002 if (mp->m_logdev_targp != mp->m_ddev_targp) { 998 if (mp->m_logdev_targp != mp->m_ddev_targp) {
1003 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); 999 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
1004 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { 1000 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
1005 cmn_err(CE_WARN, "XFS: size check 3 failed"); 1001 cmn_err(CE_WARN, "XFS: log size mismatch detected");
1006 return XFS_ERROR(EFBIG); 1002 return XFS_ERROR(EFBIG);
1007 } 1003 }
1008 error = xfs_read_buf(mp, mp->m_logdev_targp, 1004 bp = xfs_buf_read_uncached(mp, mp->m_logdev_targp,
1009 d - XFS_FSB_TO_BB(mp, 1), 1005 d - XFS_FSB_TO_BB(mp, 1),
1010 XFS_FSB_TO_BB(mp, 1), 0, &bp); 1006 XFS_FSB_TO_B(mp, 1), 0);
1011 if (!error) { 1007 if (!bp) {
1012 xfs_buf_relse(bp); 1008 cmn_err(CE_WARN, "XFS: log device read failed");
1013 } else { 1009 return EIO;
1014 cmn_err(CE_WARN, "XFS: size check 3 failed");
1015 if (error == ENOSPC)
1016 error = XFS_ERROR(EFBIG);
1017 return error;
1018 } 1010 }
1011 xfs_buf_relse(bp);
1019 } 1012 }
1020 return 0; 1013 return 0;
1021} 1014}
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 891260fea11e..12a191385310 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -39,6 +39,7 @@
39#include "xfs_trans_space.h" 39#include "xfs_trans_space.h"
40#include "xfs_utils.h" 40#include "xfs_utils.h"
41#include "xfs_trace.h" 41#include "xfs_trace.h"
42#include "xfs_buf.h"
42 43
43 44
44/* 45/*
@@ -1883,13 +1884,13 @@ xfs_growfs_rt(
1883 /* 1884 /*
1884 * Read in the last block of the device, make sure it exists. 1885 * Read in the last block of the device, make sure it exists.
1885 */ 1886 */
1886 error = xfs_read_buf(mp, mp->m_rtdev_targp, 1887 bp = xfs_buf_read_uncached(mp, mp->m_rtdev_targp,
1887 XFS_FSB_TO_BB(mp, nrblocks - 1), 1888 XFS_FSB_TO_BB(mp, nrblocks - 1),
1888 XFS_FSB_TO_BB(mp, 1), 0, &bp); 1889 XFS_FSB_TO_B(mp, 1), 0);
1889 if (error) 1890 if (!bp)
1890 return error; 1891 return EIO;
1891 ASSERT(bp);
1892 xfs_buf_relse(bp); 1892 xfs_buf_relse(bp);
1893
1893 /* 1894 /*
1894 * Calculate new parameters. These are the final values to be reached. 1895 * Calculate new parameters. These are the final values to be reached.
1895 */ 1896 */
@@ -2215,7 +2216,6 @@ xfs_rtmount_init(
2215{ 2216{
2216 xfs_buf_t *bp; /* buffer for last block of subvolume */ 2217 xfs_buf_t *bp; /* buffer for last block of subvolume */
2217 xfs_daddr_t d; /* address of last block of subvolume */ 2218 xfs_daddr_t d; /* address of last block of subvolume */
2218 int error; /* error return value */
2219 xfs_sb_t *sbp; /* filesystem superblock copy in mount */ 2219 xfs_sb_t *sbp; /* filesystem superblock copy in mount */
2220 2220
2221 sbp = &mp->m_sb; 2221 sbp = &mp->m_sb;
@@ -2242,15 +2242,12 @@ xfs_rtmount_init(
2242 (unsigned long long) mp->m_sb.sb_rblocks); 2242 (unsigned long long) mp->m_sb.sb_rblocks);
2243 return XFS_ERROR(EFBIG); 2243 return XFS_ERROR(EFBIG);
2244 } 2244 }
2245 error = xfs_read_buf(mp, mp->m_rtdev_targp, 2245 bp = xfs_buf_read_uncached(mp, mp->m_rtdev_targp,
2246 d - XFS_FSB_TO_BB(mp, 1), 2246 d - XFS_FSB_TO_BB(mp, 1),
2247 XFS_FSB_TO_BB(mp, 1), 0, &bp); 2247 XFS_FSB_TO_B(mp, 1), 0);
2248 if (error) { 2248 if (!bp) {
2249 cmn_err(CE_WARN, 2249 cmn_err(CE_WARN, "XFS: realtime device size check failed");
2250 "XFS: realtime mount -- xfs_read_buf failed, returned %d", error); 2250 return EIO;
2251 if (error == ENOSPC)
2252 return XFS_ERROR(EFBIG);
2253 return error;
2254 } 2251 }
2255 xfs_buf_relse(bp); 2252 xfs_buf_relse(bp);
2256 return 0; 2253 return 0;