aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-03-25 18:14:57 -0400
committerDave Chinner <david@fromorbit.com>2011-03-25 18:14:57 -0400
commit704b2907c2d47ceb187c0e25a6bbc2174b198f2f (patch)
tree0ca2703390a5ba43998eca28d85d77ee49a790f6
parent7401aafd5019d32a888e5f27332cf580945574bf (diff)
xfs: register the inode cache shrinker before quotachecks
During mount, we can do a quotacheck that involves a bulkstat pass on all inodes. If there are more inodes in the filesystem than can be held in memory, we require the inode cache shrinker to run to ensure that we don't run out of memory. Unfortunately, the inode cache shrinker is not registered until we get to the end of the superblock setup process, which is after a quotacheck is run if it is needed. Hence we need to register the inode cache shrinker earlier in the mount process so that we don't OOM during mount. This requires that we also initialise the syncd work before we register the shrinker, so we nee dto juggle that around as well. While there, make sure that we have set up the block sizes in the VFS superblock correctly before the quotacheck is run so that any inodes that are cached as a result of the quotacheck have their block size fields set up correctly. Cc: stable@kernel.org Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Alex Elder <aelder@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 8a70b2a17d6f..1ba5c451da36 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1539,10 +1539,14 @@ xfs_fs_fill_super(
1539 if (error) 1539 if (error)
1540 goto out_free_sb; 1540 goto out_free_sb;
1541 1541
1542 error = xfs_mountfs(mp); 1542 /*
1543 if (error) 1543 * we must configure the block size in the superblock before we run the
1544 goto out_filestream_unmount; 1544 * full mount process as the mount process can lookup and cache inodes.
1545 1545 * For the same reason we must also initialise the syncd and register
1546 * the inode cache shrinker so that inodes can be reclaimed during
1547 * operations like a quotacheck that iterate all inodes in the
1548 * filesystem.
1549 */
1546 sb->s_magic = XFS_SB_MAGIC; 1550 sb->s_magic = XFS_SB_MAGIC;
1547 sb->s_blocksize = mp->m_sb.sb_blocksize; 1551 sb->s_blocksize = mp->m_sb.sb_blocksize;
1548 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; 1552 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
@@ -1550,6 +1554,16 @@ xfs_fs_fill_super(
1550 sb->s_time_gran = 1; 1554 sb->s_time_gran = 1;
1551 set_posix_acl_flag(sb); 1555 set_posix_acl_flag(sb);
1552 1556
1557 error = xfs_syncd_init(mp);
1558 if (error)
1559 goto out_filestream_unmount;
1560
1561 xfs_inode_shrinker_register(mp);
1562
1563 error = xfs_mountfs(mp);
1564 if (error)
1565 goto out_syncd_stop;
1566
1553 root = igrab(VFS_I(mp->m_rootip)); 1567 root = igrab(VFS_I(mp->m_rootip));
1554 if (!root) { 1568 if (!root) {
1555 error = ENOENT; 1569 error = ENOENT;
@@ -1565,14 +1579,11 @@ xfs_fs_fill_super(
1565 goto fail_vnrele; 1579 goto fail_vnrele;
1566 } 1580 }
1567 1581
1568 error = xfs_syncd_init(mp);
1569 if (error)
1570 goto fail_vnrele;
1571
1572 xfs_inode_shrinker_register(mp);
1573
1574 return 0; 1582 return 0;
1575 1583
1584 out_syncd_stop:
1585 xfs_inode_shrinker_unregister(mp);
1586 xfs_syncd_stop(mp);
1576 out_filestream_unmount: 1587 out_filestream_unmount:
1577 xfs_filestream_unmount(mp); 1588 xfs_filestream_unmount(mp);
1578 out_free_sb: 1589 out_free_sb:
@@ -1596,6 +1607,9 @@ xfs_fs_fill_super(
1596 } 1607 }
1597 1608
1598 fail_unmount: 1609 fail_unmount:
1610 xfs_inode_shrinker_unregister(mp);
1611 xfs_syncd_stop(mp);
1612
1599 /* 1613 /*
1600 * Blow away any referenced inode in the filestreams cache. 1614 * Blow away any referenced inode in the filestreams cache.
1601 * This can and will cause log traffic as inodes go inactive 1615 * This can and will cause log traffic as inodes go inactive