[dm-devel] [PATCH 2/2] dm-bufio: initialize read-only module parameters

Mikulas Patocka mpatocka at redhat.com
Thu Dec 5 22:38:51 UTC 2013


The subject line should contain dm-stats, not dm-bufio.



On Thu, 5 Dec 2013, Mikulas Patocka wrote:

> dm-stats: initialize read-only module parameters
> 
> The module parameter stats_current_allocated_bytes in dm-mod is read-only.
> This parameter informs the user about memory consumption. It is not
> supposed to be changed by the user.
> 
> However, despite being read-only, this parameter can be set on modprobe or
> insmod command line:
> modprobe dm-mod stats_current_allocated_bytes=12345
> 
> The kernel doesn't expect that this variable can be non-zero at module
> initialization and if the user sets it, it results in warning.
> 
> This patch initializates the variable in the module init routine, so that
> user-supplied value is ignored.
> 
> Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
> Cc: stable at kernel.org	# 3.12+
> 
> ---
>  drivers/md/dm-bufio.c |    5 +++++
>  drivers/md/dm-stats.c |    1 +
>  2 files changed, 6 insertions(+)
> 
> Index: linux-3.13-rc2/drivers/md/dm-stats.c
> ===================================================================
> --- linux-3.13-rc2.orig/drivers/md/dm-stats.c	2013-12-05 23:08:37.000000000 +0100
> +++ linux-3.13-rc2/drivers/md/dm-stats.c	2013-12-05 23:09:00.000000000 +0100
> @@ -964,6 +964,7 @@ int dm_stats_message(struct mapped_devic
>  
>  int __init dm_statistics_init(void)
>  {
> +	shared_memory_amount = 0;
>  	dm_stat_need_rcu_barrier = 0;
>  	return 0;
>  }
> 
> --
> dm-devel mailing list
> dm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
> 




More information about the dm-devel mailing list