Commit 3a3882ff authored by Aliaksei Karaliou's avatar Aliaksei Karaliou Committed by Darrick J. Wong

xfs: quota: check result of register_shrinker()

xfs_qm_init_quotainfo() does not check result of register_shrinker()
which was tagged as __must_check recently, reported by sparse.
Signed-off-by: default avatarAliaksei Karaliou <akaraliou.dev@gmail.com>
[darrick: move xfs_qm_destroy_quotainos nearer xfs_qm_init_quotainos]
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 21968815
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
STATIC int xfs_qm_init_quotainos(xfs_mount_t *); STATIC int xfs_qm_init_quotainos(xfs_mount_t *);
STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); STATIC int xfs_qm_init_quotainfo(xfs_mount_t *);
STATIC void xfs_qm_destroy_quotainos(xfs_quotainfo_t *qi);
STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp); STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp);
/* /*
* We use the batch lookup interface to iterate over the dquots as it * We use the batch lookup interface to iterate over the dquots as it
...@@ -695,9 +695,17 @@ xfs_qm_init_quotainfo( ...@@ -695,9 +695,17 @@ xfs_qm_init_quotainfo(
qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan; qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan;
qinf->qi_shrinker.seeks = DEFAULT_SEEKS; qinf->qi_shrinker.seeks = DEFAULT_SEEKS;
qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE;
register_shrinker(&qinf->qi_shrinker);
error = register_shrinker(&qinf->qi_shrinker);
if (error)
goto out_free_inos;
return 0; return 0;
out_free_inos:
mutex_destroy(&qinf->qi_quotaofflock);
mutex_destroy(&qinf->qi_tree_lock);
xfs_qm_destroy_quotainos(qinf);
out_free_lru: out_free_lru:
list_lru_destroy(&qinf->qi_lru); list_lru_destroy(&qinf->qi_lru);
out_free_qinf: out_free_qinf:
...@@ -706,7 +714,6 @@ xfs_qm_init_quotainfo( ...@@ -706,7 +714,6 @@ xfs_qm_init_quotainfo(
return error; return error;
} }
/* /*
* Gets called when unmounting a filesystem or when all quotas get * Gets called when unmounting a filesystem or when all quotas get
* turned off. * turned off.
...@@ -723,19 +730,7 @@ xfs_qm_destroy_quotainfo( ...@@ -723,19 +730,7 @@ xfs_qm_destroy_quotainfo(
unregister_shrinker(&qi->qi_shrinker); unregister_shrinker(&qi->qi_shrinker);
list_lru_destroy(&qi->qi_lru); list_lru_destroy(&qi->qi_lru);
xfs_qm_destroy_quotainos(qi);
if (qi->qi_uquotaip) {
IRELE(qi->qi_uquotaip);
qi->qi_uquotaip = NULL; /* paranoia */
}
if (qi->qi_gquotaip) {
IRELE(qi->qi_gquotaip);
qi->qi_gquotaip = NULL;
}
if (qi->qi_pquotaip) {
IRELE(qi->qi_pquotaip);
qi->qi_pquotaip = NULL;
}
mutex_destroy(&qi->qi_tree_lock); mutex_destroy(&qi->qi_tree_lock);
mutex_destroy(&qi->qi_quotaofflock); mutex_destroy(&qi->qi_quotaofflock);
kmem_free(qi); kmem_free(qi);
...@@ -1600,6 +1595,24 @@ xfs_qm_init_quotainos( ...@@ -1600,6 +1595,24 @@ xfs_qm_init_quotainos(
return error; return error;
} }
STATIC void
xfs_qm_destroy_quotainos(
xfs_quotainfo_t *qi)
{
if (qi->qi_uquotaip) {
IRELE(qi->qi_uquotaip);
qi->qi_uquotaip = NULL; /* paranoia */
}
if (qi->qi_gquotaip) {
IRELE(qi->qi_gquotaip);
qi->qi_gquotaip = NULL;
}
if (qi->qi_pquotaip) {
IRELE(qi->qi_pquotaip);
qi->qi_pquotaip = NULL;
}
}
STATIC void STATIC void
xfs_qm_dqfree_one( xfs_qm_dqfree_one(
struct xfs_dquot *dqp) struct xfs_dquot *dqp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment