xfs: list_lru_init returns a negative error

And we don't invert it properly when initialising the dquot lru
list.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by Dave Chinner and committed by Dave Chinner ee4eec47 bc147822

+14 -12
+14 -12
fs/xfs/xfs_qm.c
··· 843 844 qinf = mp->m_quotainfo = kmem_zalloc(sizeof(xfs_quotainfo_t), KM_SLEEP); 845 846 - if ((error = list_lru_init(&qinf->qi_lru))) { 847 - kmem_free(qinf); 848 - mp->m_quotainfo = NULL; 849 - return error; 850 - } 851 852 /* 853 * See if quotainodes are setup, and if not, allocate them, 854 * and change the superblock accordingly. 855 */ 856 - if ((error = xfs_qm_init_quotainos(mp))) { 857 - list_lru_destroy(&qinf->qi_lru); 858 - kmem_free(qinf); 859 - mp->m_quotainfo = NULL; 860 - return error; 861 - } 862 863 INIT_RADIX_TREE(&qinf->qi_uquota_tree, GFP_NOFS); 864 INIT_RADIX_TREE(&qinf->qi_gquota_tree, GFP_NOFS); ··· 913 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit); 914 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); 915 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); 916 - 917 xfs_qm_dqdestroy(dqp); 918 } else { 919 qinf->qi_btimelimit = XFS_QM_BTIMELIMIT; ··· 930 qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; 931 register_shrinker(&qinf->qi_shrinker); 932 return 0; 933 } 934 935
··· 843 844 qinf = mp->m_quotainfo = kmem_zalloc(sizeof(xfs_quotainfo_t), KM_SLEEP); 845 846 + error = -list_lru_init(&qinf->qi_lru); 847 + if (error) 848 + goto out_free_qinf; 849 850 /* 851 * See if quotainodes are setup, and if not, allocate them, 852 * and change the superblock accordingly. 853 */ 854 + error = xfs_qm_init_quotainos(mp); 855 + if (error) 856 + goto out_free_lru; 857 858 INIT_RADIX_TREE(&qinf->qi_uquota_tree, GFP_NOFS); 859 INIT_RADIX_TREE(&qinf->qi_gquota_tree, GFP_NOFS); ··· 918 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit); 919 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); 920 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); 921 + 922 xfs_qm_dqdestroy(dqp); 923 } else { 924 qinf->qi_btimelimit = XFS_QM_BTIMELIMIT; ··· 935 qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; 936 register_shrinker(&qinf->qi_shrinker); 937 return 0; 938 + 939 + out_free_lru: 940 + list_lru_destroy(&qinf->qi_lru); 941 + out_free_qinf: 942 + kmem_free(qinf); 943 + mp->m_quotainfo = NULL; 944 + return error; 945 } 946 947