diff options
| -rw-r--r-- | fs/xfs/xfs_qm.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index d0053115427f..b897b11afb2c 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | STATIC int xfs_qm_init_quotainos(xfs_mount_t *); | 48 | STATIC int xfs_qm_init_quotainos(xfs_mount_t *); |
| 49 | STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); | 49 | STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); |
| 50 | 50 | ||
| 51 | 51 | STATIC void xfs_qm_destroy_quotainos(xfs_quotainfo_t *qi); | |
| 52 | STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp); | 52 | STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp); |
| 53 | /* | 53 | /* |
| 54 | * We use the batch lookup interface to iterate over the dquots as it | 54 | * We use the batch lookup interface to iterate over the dquots as it |
| @@ -695,9 +695,17 @@ xfs_qm_init_quotainfo( | |||
| 695 | qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan; | 695 | qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan; |
| 696 | qinf->qi_shrinker.seeks = DEFAULT_SEEKS; | 696 | qinf->qi_shrinker.seeks = DEFAULT_SEEKS; |
| 697 | qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; | 697 | qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; |
| 698 | register_shrinker(&qinf->qi_shrinker); | 698 | |
| 699 | error = register_shrinker(&qinf->qi_shrinker); | ||
| 700 | if (error) | ||
| 701 | goto out_free_inos; | ||
| 702 | |||
| 699 | return 0; | 703 | return 0; |
| 700 | 704 | ||
| 705 | out_free_inos: | ||
| 706 | mutex_destroy(&qinf->qi_quotaofflock); | ||
| 707 | mutex_destroy(&qinf->qi_tree_lock); | ||
| 708 | xfs_qm_destroy_quotainos(qinf); | ||
| 701 | out_free_lru: | 709 | out_free_lru: |
| 702 | list_lru_destroy(&qinf->qi_lru); | 710 | list_lru_destroy(&qinf->qi_lru); |
| 703 | out_free_qinf: | 711 | out_free_qinf: |
| @@ -706,7 +714,6 @@ out_free_qinf: | |||
| 706 | return error; | 714 | return error; |
| 707 | } | 715 | } |
| 708 | 716 | ||
| 709 | |||
| 710 | /* | 717 | /* |
| 711 | * Gets called when unmounting a filesystem or when all quotas get | 718 | * Gets called when unmounting a filesystem or when all quotas get |
| 712 | * turned off. | 719 | * turned off. |
| @@ -723,19 +730,7 @@ xfs_qm_destroy_quotainfo( | |||
| 723 | 730 | ||
| 724 | unregister_shrinker(&qi->qi_shrinker); | 731 | unregister_shrinker(&qi->qi_shrinker); |
| 725 | list_lru_destroy(&qi->qi_lru); | 732 | list_lru_destroy(&qi->qi_lru); |
| 726 | 733 | xfs_qm_destroy_quotainos(qi); | |
| 727 | if (qi->qi_uquotaip) { | ||
| 728 | IRELE(qi->qi_uquotaip); | ||
| 729 | qi->qi_uquotaip = NULL; /* paranoia */ | ||
| 730 | } | ||
| 731 | if (qi->qi_gquotaip) { | ||
| 732 | IRELE(qi->qi_gquotaip); | ||
| 733 | qi->qi_gquotaip = NULL; | ||
| 734 | } | ||
| 735 | if (qi->qi_pquotaip) { | ||
| 736 | IRELE(qi->qi_pquotaip); | ||
| 737 | qi->qi_pquotaip = NULL; | ||
| 738 | } | ||
| 739 | mutex_destroy(&qi->qi_tree_lock); | 734 | mutex_destroy(&qi->qi_tree_lock); |
| 740 | mutex_destroy(&qi->qi_quotaofflock); | 735 | mutex_destroy(&qi->qi_quotaofflock); |
| 741 | kmem_free(qi); | 736 | kmem_free(qi); |
| @@ -1601,6 +1596,24 @@ error_rele: | |||
| 1601 | } | 1596 | } |
| 1602 | 1597 | ||
| 1603 | STATIC void | 1598 | STATIC void |
| 1599 | xfs_qm_destroy_quotainos( | ||
| 1600 | xfs_quotainfo_t *qi) | ||
| 1601 | { | ||
| 1602 | if (qi->qi_uquotaip) { | ||
| 1603 | IRELE(qi->qi_uquotaip); | ||
| 1604 | qi->qi_uquotaip = NULL; /* paranoia */ | ||
| 1605 | } | ||
| 1606 | if (qi->qi_gquotaip) { | ||
| 1607 | IRELE(qi->qi_gquotaip); | ||
| 1608 | qi->qi_gquotaip = NULL; | ||
| 1609 | } | ||
| 1610 | if (qi->qi_pquotaip) { | ||
| 1611 | IRELE(qi->qi_pquotaip); | ||
| 1612 | qi->qi_pquotaip = NULL; | ||
| 1613 | } | ||
| 1614 | } | ||
| 1615 | |||
| 1616 | STATIC void | ||
| 1604 | xfs_qm_dqfree_one( | 1617 | xfs_qm_dqfree_one( |
| 1605 | struct xfs_dquot *dqp) | 1618 | struct xfs_dquot *dqp) |
| 1606 | { | 1619 | { |
