--- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2417,8 +2417,6 @@ static int resize_stripes(struct r5conf } else err = -ENOMEM; - mutex_unlock(&conf->cache_size_mutex); - conf->slab_cache = sc; conf->active_name = 1-conf->active_name; @@ -2441,6 +2439,8 @@ static int resize_stripes(struct r5conf if (!err) conf->pool_size = newsize; + mutex_unlock(&conf->cache_size_mutex); + return err; }