mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
segtype: replace mempool allocation
So this is a bit more complex and possibly worth futher checking. ATM clvmd drops cmd->mem mempool AFTER refresh of cmd. So anything allocating from cmd->mem during toolcontext init will likely die at some point in time. As a quick fix - just use regular malloc/free for 'dso' alloction. It's worth to note - cmd->libmem seems to be often misused causing hidden memleaking for clvmd.
This commit is contained in:
parent
e40768ac32
commit
32febed8d5
@ -1692,7 +1692,7 @@ char *get_monitor_dso_path(struct cmd_context *cmd, int id)
|
||||
|
||||
get_shared_library_path(cmd, libpath, path, sizeof(path));
|
||||
|
||||
return dm_pool_strdup(cmd->mem, path);
|
||||
return dm_strdup(path);
|
||||
}
|
||||
|
||||
static char *_build_target_uuid(struct cmd_context *cmd, const struct logical_volume *lv)
|
||||
|
@ -531,6 +531,7 @@ static int _mirrored_modules_needed(struct dm_pool *mem,
|
||||
|
||||
static void _mirrored_destroy(struct segment_type *segtype)
|
||||
{
|
||||
dm_free(segtype->dso);
|
||||
dm_free(segtype);
|
||||
}
|
||||
|
||||
|
@ -363,6 +363,7 @@ static int _raid_target_status_compatible(const char *type)
|
||||
|
||||
static void _raid_destroy(struct segment_type *segtype)
|
||||
{
|
||||
dm_free(segtype->dso);
|
||||
dm_free((void *) segtype);
|
||||
}
|
||||
|
||||
@ -629,7 +630,8 @@ static struct segment_type *_init_raid_segtype(struct cmd_context *cmd,
|
||||
segtype->flags = SEG_RAID | SEG_ONLY_EXCLUSIVE | rt->extra_flags;
|
||||
|
||||
/* Never monitor raid0 or raid0_meta LVs */
|
||||
if (!segtype_is_any_raid0(segtype)) {
|
||||
if (!segtype_is_any_raid0(segtype) &&
|
||||
dso && (dso = dm_strdup(dso))) {
|
||||
segtype->dso = dso;
|
||||
segtype->flags |= monitored;
|
||||
}
|
||||
@ -650,7 +652,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
|
||||
#endif
|
||||
{
|
||||
struct segment_type *segtype;
|
||||
const char *dso;
|
||||
const char *dso = NULL;
|
||||
unsigned i;
|
||||
uint64_t monitored = 0;
|
||||
|
||||
@ -669,5 +671,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
|
||||
/* segtype is already destroyed */
|
||||
return_0;
|
||||
|
||||
dm_free(dso);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -224,6 +224,7 @@ static int _snap_modules_needed(struct dm_pool *mem,
|
||||
|
||||
static void _snap_destroy(struct segment_type *segtype)
|
||||
{
|
||||
dm_free(segtype->dso);
|
||||
dm_free(segtype);
|
||||
}
|
||||
|
||||
|
@ -745,6 +745,7 @@ static int _thin_target_present(struct cmd_context *cmd,
|
||||
|
||||
static void _thin_destroy(struct segment_type *segtype)
|
||||
{
|
||||
dm_free(segtype->dso);
|
||||
dm_free(segtype);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user