From: antirez <antirez@gmail.com>
Date: Fri, 15 Jan 2010 18:17:43 +0000 (-0500)
Subject: minor fix
X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/2316bb3b428d583b88a03ad45b955d618bd320cd

minor fix
---

diff --git a/redis.c b/redis.c
index fd912b49..343dce15 100644
--- a/redis.c
+++ b/redis.c
@@ -3011,7 +3011,12 @@ static int rdbSave(char *filename) {
     int j;
     time_t now = time(NULL);
 
-    waitEmptyIOJobsQueue(); /* Otherwise other threads may fseek() the swap */
+    /* Wait for I/O therads to terminate, just in case this is a
+     * foreground-saving, to avoid seeking the swap file descriptor at the
+     * same time. */
+    if (server.vm_enabled)
+        waitEmptyIOJobsQueue();
+
     snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid());
     fp = fopen(tmpfile,"w");
     if (!fp) {