Skip to contentSkip to conversation

dlm: config: Fix ENOMEM failures in make_cluster()

PATCH In review Andrew Price 2 participants 3 messages Mar 22, 2016 – Mar 29, 2016 Distributed lock manager (DLM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dlm: config: Fix ENOMEM failures in make_cluster()

Commit 1ae1602de0 "configfs: switch ->default groups to a linked list" left the NULL gps pointer behind after removing the kcalloc() call which made it non-NULL. It also left the !gps check in place so make_cluster() now fails with ENOMEM. Remove the remaining uses of the gps variable to fix that.

---
 fs/dlm/config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/dlm/config.c +1 -2
index 5191121..1669f62 100644
@@ -343,13 +343,12 @@ static struct config_group *make_cluster(struct config_group *g,
 	struct dlm_cluster *cl = NULL;
 	struct dlm_spaces *sps = NULL;
 	struct dlm_comms *cms = NULL;
-	void *gps = NULL;
 
 	cl = kzalloc(sizeof(struct dlm_cluster), GFP_NOFS);
 	sps = kzalloc(sizeof(struct dlm_spaces), GFP_NOFS);
 	cms = kzalloc(sizeof(struct dlm_comms), GFP_NOFS);
 
-	if (!cl || !gps || !sps || !cms)
+	if (!cl || !sps || !cms)
 		goto fail;
 
 	config_group_init_type_name(&cl->group, name, &cluster_type);
Signature · 1 line
2.4.3
#1 lore raw
Quoted 9 lines · Andrew Price

Commit 1ae1602de0 "configfs: switch ->default groups to a linked list" left the NULL gps pointer behind after removing the kcalloc() call which made it non-NULL. It also left the !gps check in place so make_cluster() now fails with ENOMEM. Remove the remaining uses of the gps variable to fix that.

Oops, sorry. Thanks for fixing this up!

#2 lore raw
In reply to Andrew Price
Quoted 5 lines · Andrew Price

Commit 1ae1602de0 "configfs: switch ->default groups to a linked list" left the NULL gps pointer behind after removing the kcalloc() call which made it non-NULL. It also left the !gps check in place so make_cluster() now fails with ENOMEM. Remove the remaining uses of the gps variable to fix that.

Could this go through the linux-dlm tree as a fix for -rc2? The impact is that dlm_controld fails:

dlm_controld[890]: 171 dlm_controld 4.0.4 started dlm_controld[890]: 171 /sys/kernel/config/dlm/cluster: mkdir failed: 12

so it's pretty important.

Cheers,
Andy

Quoted 28 lines
---
  fs/dlm/config.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
fs/dlm/config.c +1 -2
index 5191121..1669f62 100644
@@ -343,13 +343,12 @@ static struct config_group *make_cluster(struct config_group *g,
  	struct dlm_cluster *cl = NULL;
  	struct dlm_spaces *sps = NULL;
  	struct dlm_comms *cms = NULL;
-	void *gps = NULL;
 
  	cl = kzalloc(sizeof(struct dlm_cluster), GFP_NOFS);
  	sps = kzalloc(sizeof(struct dlm_spaces), GFP_NOFS);
  	cms = kzalloc(sizeof(struct dlm_comms), GFP_NOFS);
 
-	if (!cl || !gps || !sps || !cms)
+	if (!cl || !sps || !cms)
  		goto fail;
 
  	config_group_init_type_name(&cl->group, name, &cluster_type);