summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2016-09-20 10:33:57 +0800
committerShaohua Li <shli@fb.com>2016-09-21 09:09:44 -0700
commit6a0f53ff351dfd10e74752e57b9c27d3397a3c4d (patch)
tree696fbffa8a7082f4c348a0244922ff4bace4594e /drivers/md
parent90bcf1338193da4c87fb7492c716f225b907acf4 (diff)
raid5: fix to detect failure of register_shrinker
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> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5883ef0d95bf..08274b4b4009 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6670,7 +6670,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);