From 53db5959233fb8977ff6c9cc0fc743239704f7e9 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Sat, 16 Nov 2019 15:09:56 +0800
Subject: [PATCH] syslog more when use libdevmapper.so

When docker use function of libdevmapper.so, it don't log to syslog.
This patch make it also log to syslog.

Signed-off-by: wangjufeng<wangjufeng@huawei.com>
---
 libdm/libdm-common.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 0b03106..2fd8783 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -132,6 +132,7 @@ static void _default_log_line(int level, const char *file,
 			fprintf(out, "%s:%d     ", file, line);
 
 		vfprintf(out, f, ap);
+		vsyslog(level, f, ap);
 		fputc('\n', out);
 	}
 
@@ -2586,11 +2587,15 @@ int dm_udev_complete(uint32_t cookie)
 {
 	int semid;
 
-	if (!cookie || !dm_udev_get_sync_support())
+	if (!cookie || !dm_udev_get_sync_support()) {
+		log_print("Do not wait cookie:0x%x", cookie);
 		return 1;
+	}
 
-	if (!_get_cookie_sem(cookie, &semid))
+	if (!_get_cookie_sem(cookie, &semid)) {
+		log_error("Could not get cookie 0x%x sem %d", cookie, semid);
 		return_0;
+	}
 
 	if (!_udev_notify_sem_dec(cookie, semid)) {
 		log_error("Could not signal waiting process using notification "
@@ -2598,7 +2603,7 @@ int dm_udev_complete(uint32_t cookie)
 			  cookie, cookie);
 		return 0;
 	}
-
+	log_print("Complete cookie 0x%x success.", cookie);
 	return 1;
 }
 
-- 
2.19.1

