linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] zcache: initialize module properly when zcache=FOO is given
@ 2013-06-27  1:32 Bob Liu
  2013-06-27  9:12 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Liu @ 2013-06-27  1:32 UTC (permalink / raw)
  To: gregkh; +Cc: mhocko, konrad.wilk, akpm, linux-mm, crrodriguez, Bob Liu

From: Michal Hocko <mhocko@suse.cz>

835f2f51 (staging: zcache: enable zcache to be built/loaded as a module)
introduced in 3.10-rc1 has introduced a bug for zcache=FOO module
parameter processing.

zcache_comp_init return code doesn't agree with crypto_has_comp which
uses 1 for the success unlike zcache_comp_init which uses 0. This
causes module loading failure even if the given algorithm is supported:
[    0.815330] zcache: compressor initialization failed

Reported-by: Cristian RodrA-guez <crrodriguez@opensuse.org>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 drivers/staging/zcache/zcache-main.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index dcceed2..0fe530b 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void)
 #else
 	if (*zcache_comp_name != '\0') {
 		ret = crypto_has_comp(zcache_comp_name, 0, 0);
-		if (!ret)
+		if (!ret) {
 			pr_info("zcache: %s not supported\n",
 					zcache_comp_name);
-		goto out;
+			goto out;
+		}
+		goto out_alloc;
 	}
 	if (!ret)
 		strcpy(zcache_comp_name, "lzo");
@@ -1827,6 +1829,7 @@ static int zcache_comp_init(void)
 	pr_info("zcache: using %s compressor\n", zcache_comp_name);
 
 	/* alloc percpu transforms */
+out_alloc:
 	ret = 0;
 	zcache_comp_pcpu_tfms = alloc_percpu(struct crypto_comp *);
 	if (!zcache_comp_pcpu_tfms)
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] zcache: initialize module properly when zcache=FOO is given
  2013-06-27  1:32 [RESEND PATCH] zcache: initialize module properly when zcache=FOO is given Bob Liu
@ 2013-06-27  9:12 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2013-06-27  9:12 UTC (permalink / raw)
  To: gregkh; +Cc: Bob Liu, konrad.wilk, akpm, linux-mm, crrodriguez, Bob Liu

Please make sure that this will get into 3.10 or it would have to get to
it via stable tree.

On Thu 27-06-13 09:32:20, Bob Liu wrote:
> From: Michal Hocko <mhocko@suse.cz>
> 
> 835f2f51 (staging: zcache: enable zcache to be built/loaded as a module)
> introduced in 3.10-rc1 has introduced a bug for zcache=FOO module
> parameter processing.
> 
> zcache_comp_init return code doesn't agree with crypto_has_comp which
> uses 1 for the success unlike zcache_comp_init which uses 0. This
> causes module loading failure even if the given algorithm is supported:
> [    0.815330] zcache: compressor initialization failed
> 
> Reported-by: Cristian Rodriguez <crrodriguez@opensuse.org>
> Signed-off-by: Michal Hocko <mhocko@suse.cz>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
>  drivers/staging/zcache/zcache-main.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index dcceed2..0fe530b 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1811,10 +1811,12 @@ static int zcache_comp_init(void)
>  #else
>  	if (*zcache_comp_name != '\0') {
>  		ret = crypto_has_comp(zcache_comp_name, 0, 0);
> -		if (!ret)
> +		if (!ret) {
>  			pr_info("zcache: %s not supported\n",
>  					zcache_comp_name);
> -		goto out;
> +			goto out;
> +		}
> +		goto out_alloc;
>  	}
>  	if (!ret)
>  		strcpy(zcache_comp_name, "lzo");
> @@ -1827,6 +1829,7 @@ static int zcache_comp_init(void)
>  	pr_info("zcache: using %s compressor\n", zcache_comp_name);
>  
>  	/* alloc percpu transforms */
> +out_alloc:
>  	ret = 0;
>  	zcache_comp_pcpu_tfms = alloc_percpu(struct crypto_comp *);
>  	if (!zcache_comp_pcpu_tfms)
> -- 
> 1.7.10.4
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-27  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27  1:32 [RESEND PATCH] zcache: initialize module properly when zcache=FOO is given Bob Liu
2013-06-27  9:12 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox