Blame SOURCES/0021-Load-leases-DB-in-non-replay-mode-only.patch

f9ed25
commit 50c2b3ba8ce030a47b55dd707bb8a6ab20444a05
f9ed25
Author: Pavel Zhukov <pzhukov@redhat.com>
f9ed25
Date:   Thu Feb 21 10:44:06 2019 +0100
f9ed25
f9ed25
    Load leases DB in non-replay mode only
f9ed25
f9ed25
diff --git a/server/confpars.c b/server/confpars.c
f9ed25
index 2743979..6b61964 100644
f9ed25
--- a/server/confpars.c
f9ed25
+++ b/server/confpars.c
f9ed25
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
f9ed25
 
f9ed25
 	cfile = (struct parse *)0;
f9ed25
 #if defined (TRACING)
f9ed25
+	// No need to dmalloc huge memory region if we're not going to re-play
f9ed25
+	if (!trace_record()){
f9ed25
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
f9ed25
+		goto noreplay;
f9ed25
+	};
f9ed25
 	flen = lseek (file, (off_t)0, SEEK_END);
f9ed25
 	if (flen < 0) {
f9ed25
 	      boom:
f9ed25
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
f9ed25
 	if (result != ulen)
f9ed25
 		log_fatal ("%s: short read of %d bytes instead of %d.",
f9ed25
 			   filename, ulen, result);
f9ed25
-	close (file);
f9ed25
       memfile:
f9ed25
 	/* If we're recording, write out the filename and file contents. */
f9ed25
 	if (trace_record ())
f9ed25
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
f9ed25
 #else
f9ed25
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
f9ed25
 #endif
f9ed25
+      noreplay:
f9ed25
+	if (!trace_playback())
f9ed25
+		close (file);
f9ed25
 	if (status != ISC_R_SUCCESS || cfile == NULL)
f9ed25
 		return status;
f9ed25
 
f9ed25
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
f9ed25
 		status = conf_file_subparse (cfile, group, group_type);
f9ed25
 	end_parse (&cfile);
f9ed25
 #if defined (TRACING)
f9ed25
-	dfree (dbuf, MDL);
f9ed25
+	if (trace_record())
f9ed25
+	    dfree (dbuf, MDL);
f9ed25
 #endif
f9ed25
 	return status;
f9ed25
 }