aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_ialloc.c3
-rw-r--r--fs/xfs/xfs_inode.c22
2 files changed, 15 insertions, 10 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index deddbd03c166..7e5ccfec92be 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -1174,6 +1174,9 @@ xfs_dilocate(
1174 if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks || 1174 if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks ||
1175 ino != XFS_AGINO_TO_INO(mp, agno, agino)) { 1175 ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
1176#ifdef DEBUG 1176#ifdef DEBUG
1177 /* no diagnostics for bulkstat, ino comes from userspace */
1178 if (flags & XFS_IMAP_BULKSTAT)
1179 return XFS_ERROR(EINVAL);
1177 if (agno >= mp->m_sb.sb_agcount) { 1180 if (agno >= mp->m_sb.sb_agcount) {
1178 xfs_fs_cmn_err(CE_ALERT, mp, 1181 xfs_fs_cmn_err(CE_ALERT, mp,
1179 "xfs_dilocate: agno (%d) >= " 1182 "xfs_dilocate: agno (%d) >= "
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 926d372ae0f9..9af9e32a6a16 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -256,13 +256,11 @@ xfs_itobp(
256 xfs_daddr_t bno, 256 xfs_daddr_t bno,
257 uint imap_flags) 257 uint imap_flags)
258{ 258{
259 xfs_imap_t imap;
259 xfs_buf_t *bp; 260 xfs_buf_t *bp;
260 int error; 261 int error;
261 xfs_imap_t imap;
262#ifdef __KERNEL__
263 int i; 262 int i;
264 int ni; 263 int ni;
265#endif
266 264
267 if (ip->i_blkno == (xfs_daddr_t)0) { 265 if (ip->i_blkno == (xfs_daddr_t)0) {
268 /* 266 /*
@@ -319,7 +317,6 @@ xfs_itobp(
319 */ 317 */
320 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno, 318 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno,
321 (int)imap.im_len, XFS_BUF_LOCK, &bp); 319 (int)imap.im_len, XFS_BUF_LOCK, &bp);
322
323 if (error) { 320 if (error) {
324#ifdef DEBUG 321#ifdef DEBUG
325 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_itobp: " 322 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_itobp: "
@@ -330,17 +327,21 @@ xfs_itobp(
330#endif /* DEBUG */ 327#endif /* DEBUG */
331 return error; 328 return error;
332 } 329 }
333#ifdef __KERNEL__ 330
334 /* 331 /*
335 * Validate the magic number and version of every inode in the buffer 332 * Validate the magic number and version of every inode in the buffer
336 * (if DEBUG kernel) or the first inode in the buffer, otherwise. 333 * (if DEBUG kernel) or the first inode in the buffer, otherwise.
334 * No validation is done here in userspace (xfs_repair).
337 */ 335 */
338#ifdef DEBUG 336#if !defined(__KERNEL__)
337 ni = 0;
338#elif defined(DEBUG)
339 ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 339 ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 :
340 (BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog); 340 (BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog);
341#else 341#else /* usual case */
342 ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1; 342 ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1;
343#endif 343#endif
344
344 for (i = 0; i < ni; i++) { 345 for (i = 0; i < ni; i++) {
345 int di_ok; 346 int di_ok;
346 xfs_dinode_t *dip; 347 xfs_dinode_t *dip;
@@ -352,8 +353,10 @@ xfs_itobp(
352 if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP, 353 if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP,
353 XFS_RANDOM_ITOBP_INOTOBP))) { 354 XFS_RANDOM_ITOBP_INOTOBP))) {
354#ifdef DEBUG 355#ifdef DEBUG
355 cmn_err(CE_ALERT, "Device %s - bad inode magic/vsn " 356 if (!(imap_flags & XFS_IMAP_BULKSTAT))
356 "daddr %lld #%d (magic=%x)", 357 cmn_err(CE_ALERT,
358 "Device %s - bad inode magic/vsn "
359 "daddr %lld #%d (magic=%x)",
357 XFS_BUFTARG_NAME(mp->m_ddev_targp), 360 XFS_BUFTARG_NAME(mp->m_ddev_targp),
358 (unsigned long long)imap.im_blkno, i, 361 (unsigned long long)imap.im_blkno, i,
359 INT_GET(dip->di_core.di_magic, ARCH_CONVERT)); 362 INT_GET(dip->di_core.di_magic, ARCH_CONVERT));
@@ -364,7 +367,6 @@ xfs_itobp(
364 return XFS_ERROR(EFSCORRUPTED); 367 return XFS_ERROR(EFSCORRUPTED);
365 } 368 }
366 } 369 }
367#endif /* __KERNEL__ */
368 370
369 xfs_inobp_check(mp, bp); 371 xfs_inobp_check(mp, bp);
370 372