diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index fbf0384a466f..142c460fc64e 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -302,21 +302,15 @@ xfs_readsb( | |||
302 | * access to the superblock. | 302 | * access to the superblock. |
303 | */ | 303 | */ |
304 | reread: | 304 | reread: |
305 | bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, | 305 | error = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, |
306 | BTOBB(sector_size), 0, buf_ops); | 306 | BTOBB(sector_size), 0, &bp, buf_ops); |
307 | if (!bp) { | 307 | if (error) { |
308 | if (loud) | ||
309 | xfs_warn(mp, "SB buffer read failed"); | ||
310 | return -EIO; | ||
311 | } | ||
312 | if (bp->b_error) { | ||
313 | error = bp->b_error; | ||
314 | if (loud) | 308 | if (loud) |
315 | xfs_warn(mp, "SB validate failed with error %d.", error); | 309 | xfs_warn(mp, "SB validate failed with error %d.", error); |
316 | /* bad CRC means corrupted metadata */ | 310 | /* bad CRC means corrupted metadata */ |
317 | if (error == -EFSBADCRC) | 311 | if (error == -EFSBADCRC) |
318 | error = -EFSCORRUPTED; | 312 | error = -EFSCORRUPTED; |
319 | goto release_buf; | 313 | return error; |
320 | } | 314 | } |
321 | 315 | ||
322 | /* | 316 | /* |
@@ -546,40 +540,43 @@ xfs_set_inoalignment(xfs_mount_t *mp) | |||
546 | * Check that the data (and log if separate) is an ok size. | 540 | * Check that the data (and log if separate) is an ok size. |
547 | */ | 541 | */ |
548 | STATIC int | 542 | STATIC int |
549 | xfs_check_sizes(xfs_mount_t *mp) | 543 | xfs_check_sizes( |
544 | struct xfs_mount *mp) | ||
550 | { | 545 | { |
551 | xfs_buf_t *bp; | 546 | struct xfs_buf *bp; |
552 | xfs_daddr_t d; | 547 | xfs_daddr_t d; |
548 | int error; | ||
553 | 549 | ||
554 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); | 550 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); |
555 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { | 551 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { |
556 | xfs_warn(mp, "filesystem size mismatch detected"); | 552 | xfs_warn(mp, "filesystem size mismatch detected"); |
557 | return -EFBIG; | 553 | return -EFBIG; |
558 | } | 554 | } |
559 | bp = xfs_buf_read_uncached(mp->m_ddev_targp, | 555 | error = xfs_buf_read_uncached(mp->m_ddev_targp, |
560 | d - XFS_FSS_TO_BB(mp, 1), | 556 | d - XFS_FSS_TO_BB(mp, 1), |
561 | XFS_FSS_TO_BB(mp, 1), 0, NULL); | 557 | XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL); |
562 | if (!bp) { | 558 | if (error) { |
563 | xfs_warn(mp, "last sector read failed"); | 559 | xfs_warn(mp, "last sector read failed"); |
564 | return -EIO; | 560 | return error; |
565 | } | 561 | } |
566 | xfs_buf_relse(bp); | 562 | xfs_buf_relse(bp); |
567 | 563 | ||
568 | if (mp->m_logdev_targp != mp->m_ddev_targp) { | 564 | if (mp->m_logdev_targp == mp->m_ddev_targp) |
569 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); | 565 | return 0; |
570 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { | 566 | |
571 | xfs_warn(mp, "log size mismatch detected"); | 567 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); |
572 | return -EFBIG; | 568 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { |
573 | } | 569 | xfs_warn(mp, "log size mismatch detected"); |
574 | bp = xfs_buf_read_uncached(mp->m_logdev_targp, | 570 | return -EFBIG; |
571 | } | ||
572 | error = xfs_buf_read_uncached(mp->m_logdev_targp, | ||
575 | d - XFS_FSB_TO_BB(mp, 1), | 573 | d - XFS_FSB_TO_BB(mp, 1), |
576 | XFS_FSB_TO_BB(mp, 1), 0, NULL); | 574 | XFS_FSB_TO_BB(mp, 1), 0, &bp, NULL); |
577 | if (!bp) { | 575 | if (error) { |
578 | xfs_warn(mp, "log device read failed"); | 576 | xfs_warn(mp, "log device read failed"); |
579 | return -EIO; | 577 | return error; |
580 | } | ||
581 | xfs_buf_relse(bp); | ||
582 | } | 578 | } |
579 | xfs_buf_relse(bp); | ||
583 | return 0; | 580 | return 0; |
584 | } | 581 | } |
585 | 582 | ||