All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] raid5: fix to detect failure of register_shrinker
@ 2016-09-20  2:33 ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2016-09-20  2:33 UTC (permalink / raw)
  To: shli; +Cc: linux-raid, linux-kernel, chao, Chao Yu

register_shrinker can fail after commit 1d3d4437eae1 ("vmscan: per-node
deferred work"), we should detect the failure of it, otherwise we may
fail to register shrinker after raid5 configuration was setup successfully.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 drivers/md/raid5.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 766c3b7..b819a9a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6632,7 +6632,12 @@ static struct r5conf *setup_conf(struct mddev *mddev)
 	conf->shrinker.count_objects = raid5_cache_count;
 	conf->shrinker.batch = 128;
 	conf->shrinker.flags = 0;
-	register_shrinker(&conf->shrinker);
+	if (register_shrinker(&conf->shrinker)) {
+		printk(KERN_ERR
+		       "md/raid:%s: couldn't register shrinker.\n",
+		       mdname(mddev));
+		goto abort;
+	}
 
 	sprintf(pers_name, "raid%d", mddev->new_level);
 	conf->thread = md_register_thread(raid5d, mddev, pers_name);
-- 
2.7.2

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

* [PATCH] raid5: fix to detect failure of register_shrinker
@ 2016-09-20  2:33 ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2016-09-20  2:33 UTC (permalink / raw)
  To: shli; +Cc: linux-raid, linux-kernel, chao, Chao Yu

register_shrinker can fail after commit 1d3d4437eae1 ("vmscan: per-node
deferred work"), we should detect the failure of it, otherwise we may
fail to register shrinker after raid5 configuration was setup successfully.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 drivers/md/raid5.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 766c3b7..b819a9a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6632,7 +6632,12 @@ static struct r5conf *setup_conf(struct mddev *mddev)
 	conf->shrinker.count_objects = raid5_cache_count;
 	conf->shrinker.batch = 128;
 	conf->shrinker.flags = 0;
-	register_shrinker(&conf->shrinker);
+	if (register_shrinker(&conf->shrinker)) {
+		printk(KERN_ERR
+		       "md/raid:%s: couldn't register shrinker.\n",
+		       mdname(mddev));
+		goto abort;
+	}
 
 	sprintf(pers_name, "raid%d", mddev->new_level);
 	conf->thread = md_register_thread(raid5d, mddev, pers_name);
-- 
2.7.2

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

* Re: [PATCH] raid5: fix to detect failure of register_shrinker
  2016-09-20  2:33 ` Chao Yu
  (?)
@ 2016-09-21 16:01 ` Shaohua Li
  -1 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2016-09-21 16:01 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-raid, linux-kernel, chao

On Tue, Sep 20, 2016 at 10:33:57AM +0800, Chao Yu wrote:
> register_shrinker can fail after commit 1d3d4437eae1 ("vmscan: per-node
> deferred work"), we should detect the failure of it, otherwise we may
> fail to register shrinker after raid5 configuration was setup successfully.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  drivers/md/raid5.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 766c3b7..b819a9a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -6632,7 +6632,12 @@ static struct r5conf *setup_conf(struct mddev *mddev)
>  	conf->shrinker.count_objects = raid5_cache_count;
>  	conf->shrinker.batch = 128;
>  	conf->shrinker.flags = 0;
> -	register_shrinker(&conf->shrinker);
> +	if (register_shrinker(&conf->shrinker)) {
> +		printk(KERN_ERR
> +		       "md/raid:%s: couldn't register shrinker.\n",
> +		       mdname(mddev));
> +		goto abort;
> +	}
>  
>  	sprintf(pers_name, "raid%d", mddev->new_level);
>  	conf->thread = md_register_thread(raid5d, mddev, pers_name);

shrinker isn't fatal for raid5. Idealy we can ignore the error and stop
automatically stripe cache increase, but probable it's not worthy the effort.
Applied the patch.

Also the free_conf need better way to check if shrinker register successes. I
add another patch to fix it.

Thanks,
Shaohua

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

end of thread, other threads:[~2016-09-21 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20  2:33 [PATCH] raid5: fix to detect failure of register_shrinker Chao Yu
2016-09-20  2:33 ` Chao Yu
2016-09-21 16:01 ` Shaohua Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.