[Devel] [RFC rh7] ve/vznetstat: Move VE networks statistics allocation into a commaon place
Andrew Vagin
avagin at gmail.com
Mon Jul 20 05:55:18 PDT 2015
On Sat, Jul 18, 2015 at 10:40:23AM +0300, Cyrill Gorcunov wrote:
> +
> +static void __exit __exit_venetstat(void)
> +{
> + struct ve_struct *ve;
> +
> + mutex_lock(&ve_list_lock);
> + for_each_ve(ve) {
> + venet_acct_put_stat(ve->stat);
> + ve->stat = NULL;
> + }
> + mutex_unlock(&ve_list_lock);
> +
venet_acct_hook can be called in this moment. I think we need to
unregister the hook before the previous loop.
> + ve_hook_unregister(&venet_acct_hook);
> +}
>
> int __init venetstat_init(void)
> {
> @@ -1095,6 +1156,10 @@ int __init venetstat_init(void)
> for (i = 0; i < STAT_HASH_LEN; i++)
> INIT_LIST_HEAD(stat_hash_list + i);
>
> + i = __init_venetstat();
> + if (i)
> + return i;
This looks ugly. Could you declare one more variable with more suitable
name.
> +
> #if CONFIG_PROC_FS
> de = proc_create("venetstat", S_IFREG|S_IRUSR, proc_vz_dir,
> &proc_venetstat_operations);
> @@ -1113,6 +1178,7 @@ int __init venetstat_init(void)
>
> void __exit venetstat_exit(void)
> {
> + __exit_venetstat();
> vzioctl_unregister(&tc_ioctl_info);
> venet_acct_destroy_all_stat();
>
More information about the Devel
mailing list