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