--- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2429,8 +2429,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; @@ -2453,6 +2451,8 @@ static int resize_stripes(struct r5conf if (!err) conf->pool_size = newsize; + mutex_unlock(&conf->cache_size_mutex); + return err; }