Skip to content

Commit 700ab1c

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: fix memory leak when fenced
I got some kmemleak report when a node was fenced. The user space tool dlm_controld will therefore run some rmdir() in dlm configfs which was triggering some memleaks. This patch stores the sps and cms attributes which stores some handling for subdirectories of the configfs cluster entry and free them if they get released as the parent directory gets freed. unreferenced object 0xffff88810d9e3e00 (size 192): comm "dlm_controld", pid 342, jiffies 4294698126 (age 55438.801s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 73 70 61 63 65 73 00 00 ........spaces.. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000db8b640b>] make_cluster+0x5d/0x360 [<000000006a571db4>] configfs_mkdir+0x274/0x730 [<00000000b094501c>] vfs_mkdir+0x27e/0x340 [<0000000058b0adaf>] do_mkdirat+0xff/0x1b0 [<00000000d1ffd156>] do_syscall_64+0x40/0x80 [<00000000ab1408c8>] entry_SYSCALL_64_after_hwframe+0x44/0xae unreferenced object 0xffff88810d9e3a00 (size 192): comm "dlm_controld", pid 342, jiffies 4294698126 (age 55438.801s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 63 6f 6d 6d 73 00 00 00 ........comms... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000a7ef6ad2>] make_cluster+0x82/0x360 [<000000006a571db4>] configfs_mkdir+0x274/0x730 [<00000000b094501c>] vfs_mkdir+0x27e/0x340 [<0000000058b0adaf>] do_mkdirat+0xff/0x1b0 [<00000000d1ffd156>] do_syscall_64+0x40/0x80 [<00000000ab1408c8>] entry_SYSCALL_64_after_hwframe+0x44/0xae Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent fcef0e6 commit 700ab1c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/dlm/config.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ struct dlm_cluster {
8080
unsigned int cl_new_rsb_count;
8181
unsigned int cl_recover_callbacks;
8282
char cl_cluster_name[DLM_LOCKSPACE_LEN];
83+
84+
struct dlm_spaces *sps;
85+
struct dlm_comms *cms;
8386
};
8487

8588
static struct dlm_cluster *config_item_to_cluster(struct config_item *i)
@@ -410,6 +413,9 @@ static struct config_group *make_cluster(struct config_group *g,
410413
if (!cl || !sps || !cms)
411414
goto fail;
412415

416+
cl->sps = sps;
417+
cl->cms = cms;
418+
413419
config_group_init_type_name(&cl->group, name, &cluster_type);
414420
config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type);
415421
config_group_init_type_name(&cms->cs_group, "comms", &comms_type);
@@ -459,6 +465,9 @@ static void drop_cluster(struct config_group *g, struct config_item *i)
459465
static void release_cluster(struct config_item *i)
460466
{
461467
struct dlm_cluster *cl = config_item_to_cluster(i);
468+
469+
kfree(cl->sps);
470+
kfree(cl->cms);
462471
kfree(cl);
463472
}
464473

0 commit comments

Comments
 (0)