diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 0081657ad985..d06afbc3540d 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -44,9 +44,6 @@ | |||
44 | #include "xfs_trace.h" | 44 | #include "xfs_trace.h" |
45 | 45 | ||
46 | 46 | ||
47 | STATIC void xfs_unmountfs_wait(xfs_mount_t *); | ||
48 | |||
49 | |||
50 | #ifdef HAVE_PERCPU_SB | 47 | #ifdef HAVE_PERCPU_SB |
51 | STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t, | 48 | STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t, |
52 | int); | 49 | int); |
@@ -1484,7 +1481,7 @@ xfs_unmountfs( | |||
1484 | * state as much as possible. | 1481 | * state as much as possible. |
1485 | */ | 1482 | */ |
1486 | xfs_reclaim_inodes(mp, 0); | 1483 | xfs_reclaim_inodes(mp, 0); |
1487 | XFS_bflush(mp->m_ddev_targp); | 1484 | xfs_flush_buftarg(mp->m_ddev_targp, 1); |
1488 | xfs_reclaim_inodes(mp, SYNC_WAIT); | 1485 | xfs_reclaim_inodes(mp, SYNC_WAIT); |
1489 | 1486 | ||
1490 | xfs_qm_unmount(mp); | 1487 | xfs_qm_unmount(mp); |
@@ -1496,11 +1493,6 @@ xfs_unmountfs( | |||
1496 | */ | 1493 | */ |
1497 | xfs_log_force(mp, XFS_LOG_SYNC); | 1494 | xfs_log_force(mp, XFS_LOG_SYNC); |
1498 | 1495 | ||
1499 | xfs_binval(mp->m_ddev_targp); | ||
1500 | if (mp->m_rtdev_targp) { | ||
1501 | xfs_binval(mp->m_rtdev_targp); | ||
1502 | } | ||
1503 | |||
1504 | /* | 1496 | /* |
1505 | * Unreserve any blocks we have so that when we unmount we don't account | 1497 | * Unreserve any blocks we have so that when we unmount we don't account |
1506 | * the reserved free space as used. This is really only necessary for | 1498 | * the reserved free space as used. This is really only necessary for |
@@ -1526,7 +1518,16 @@ xfs_unmountfs( | |||
1526 | xfs_warn(mp, "Unable to update superblock counters. " | 1518 | xfs_warn(mp, "Unable to update superblock counters. " |
1527 | "Freespace may not be correct on next mount."); | 1519 | "Freespace may not be correct on next mount."); |
1528 | xfs_unmountfs_writesb(mp); | 1520 | xfs_unmountfs_writesb(mp); |
1529 | xfs_unmountfs_wait(mp); /* wait for async bufs */ | 1521 | |
1522 | /* | ||
1523 | * Make sure all buffers have been flushed and completed before | ||
1524 | * unmounting the log. | ||
1525 | */ | ||
1526 | error = xfs_flush_buftarg(mp->m_ddev_targp, 1); | ||
1527 | if (error) | ||
1528 | xfs_warn(mp, "%d busy buffers during unmount.", error); | ||
1529 | xfs_wait_buftarg(mp->m_ddev_targp); | ||
1530 | |||
1530 | xfs_log_unmount_write(mp); | 1531 | xfs_log_unmount_write(mp); |
1531 | xfs_log_unmount(mp); | 1532 | xfs_log_unmount(mp); |
1532 | xfs_uuid_unmount(mp); | 1533 | xfs_uuid_unmount(mp); |
@@ -1537,16 +1538,6 @@ xfs_unmountfs( | |||
1537 | xfs_free_perag(mp); | 1538 | xfs_free_perag(mp); |
1538 | } | 1539 | } |
1539 | 1540 | ||
1540 | STATIC void | ||
1541 | xfs_unmountfs_wait(xfs_mount_t *mp) | ||
1542 | { | ||
1543 | if (mp->m_logdev_targp != mp->m_ddev_targp) | ||
1544 | xfs_wait_buftarg(mp->m_logdev_targp); | ||
1545 | if (mp->m_rtdev_targp) | ||
1546 | xfs_wait_buftarg(mp->m_rtdev_targp); | ||
1547 | xfs_wait_buftarg(mp->m_ddev_targp); | ||
1548 | } | ||
1549 | |||
1550 | int | 1541 | int |
1551 | xfs_fs_writable(xfs_mount_t *mp) | 1542 | xfs_fs_writable(xfs_mount_t *mp) |
1552 | { | 1543 | { |
@@ -1612,15 +1603,14 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) | |||
1612 | 1603 | ||
1613 | XFS_BUF_UNDONE(sbp); | 1604 | XFS_BUF_UNDONE(sbp); |
1614 | XFS_BUF_UNREAD(sbp); | 1605 | XFS_BUF_UNREAD(sbp); |
1615 | XFS_BUF_UNDELAYWRITE(sbp); | 1606 | xfs_buf_delwri_dequeue(sbp); |
1616 | XFS_BUF_WRITE(sbp); | 1607 | XFS_BUF_WRITE(sbp); |
1617 | XFS_BUF_UNASYNC(sbp); | 1608 | XFS_BUF_UNASYNC(sbp); |
1618 | ASSERT(sbp->b_target == mp->m_ddev_targp); | 1609 | ASSERT(sbp->b_target == mp->m_ddev_targp); |
1619 | xfsbdstrat(mp, sbp); | 1610 | xfsbdstrat(mp, sbp); |
1620 | error = xfs_buf_iowait(sbp); | 1611 | error = xfs_buf_iowait(sbp); |
1621 | if (error) | 1612 | if (error) |
1622 | xfs_ioerror_alert("xfs_unmountfs_writesb", | 1613 | xfs_buf_ioerror_alert(sbp, __func__); |
1623 | mp, sbp, XFS_BUF_ADDR(sbp)); | ||
1624 | xfs_buf_relse(sbp); | 1614 | xfs_buf_relse(sbp); |
1625 | } | 1615 | } |
1626 | return error; | 1616 | return error; |