From 1ba11aa7eebb8367e4e0073683db06d53e8fe6e6 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 9 Mar 2017 21:14:50 +0000 Subject: [PATCH] dmfilemapd: always set the program_id after listing regions The filemap daemon takes its program_id from the regions it is managing: use DM_STATS_ALL_PROGRAMS when retrieving an initial listing and then obtain the correct program_id from the group leader. --- daemons/dmfilemapd/dmfilemapd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c index edf66fc1d..67f86d32c 100644 --- a/daemons/dmfilemapd/dmfilemapd.c +++ b/daemons/dmfilemapd/dmfilemapd.c @@ -514,7 +514,7 @@ static void _filemap_monitor_destroy(struct filemap_monitor *fm) _filemap_monitor_end_notify(fm); _filemap_monitor_close_fd(fm); } - dm_free(fm->program_id); + dm_free((void *) fm->program_id); } static int _filemap_monitor_check_same_file(int fd1, int fd2) @@ -690,7 +690,7 @@ static int _dmfilemapd(struct filemap_monitor *fm) if (!_filemap_monitor_set_notify(fm)) goto bad; - if (!dm_stats_list(dms, NULL)) { + if (!dm_stats_list(dms, DM_STATS_ALL_PROGRAMS)) { log_error("Failed to list stats handle."); goto bad; } @@ -705,6 +705,7 @@ static int _dmfilemapd(struct filemap_monitor *fm) fm->program_id = dm_strdup(program_id); else fm->program_id = NULL; + dm_stats_set_program_id(dms, 1, program_id); do { if (!dm_stats_group_present(dms, fm->group_id)) {