Skip to content

Commit

Permalink
raid5: fix to detect failure of register_shrinker
Browse files Browse the repository at this point in the history
register_shrinker can fail after commit 1d3d443 ("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>
  • Loading branch information
Chao Yu authored and Shaohua Li committed Sep 21, 2016
1 parent 90bcf13 commit 6a0f53f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6a0f53f

Please sign in to comment.