]> git.tuebingen.mpg.de Git - dss.git/blobdiff - dss.c
Skip unnecessary check whether next snapshot is due.
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index 53707bd1cbd6fd0da5197096dc484466ba63805f..e4415f5f7c4d4a789f508899e715d9492bb387ee 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -553,6 +553,7 @@ static void stop_create_process(void)
 {
        if (!create_pid || create_process_stopped)
                return;
+       DSS_INFO_LOG("suspending create process %d\n", (int)create_pid);
        kill(SIGSTOP, create_pid);
        create_process_stopped = 1;
 }
@@ -561,6 +562,7 @@ static void restart_create_process(void)
 {
        if (!create_pid || !create_process_stopped)
                return;
+       DSS_INFO_LOG("resuming create process %d\n", (int)create_pid);
        kill (SIGCONT, create_pid);
        create_process_stopped = 0;
 }
@@ -777,18 +779,22 @@ static int handle_sigchld(void)
        if (pid == create_pid) {
                switch (snapshot_creation_status) {
                case HS_PRE_RUNNING:
-                       return handle_pre_create_hook_exit(status);
+                       ret = handle_pre_create_hook_exit(status);
+                       break;
                case HS_RUNNING:
-                       return handle_rsync_exit(status);
+                       ret = handle_rsync_exit(status);
+                       break;
                case HS_POST_RUNNING:
                        snapshot_creation_status = HS_READY;
-                       return 1;
+                       ret = 1;
+                       break;
                default:
                        DSS_EMERG_LOG("BUG: create can't die in status %d\n",
                                snapshot_creation_status);
                        return -E_BUG;
                }
                create_pid = 0;
+               return ret;
        }
        if (pid == remove_pid) {
                ret = handle_remove_exit(status);
@@ -1073,7 +1079,6 @@ static int select_loop(void)
                }
                FD_ZERO(&rfds);
                FD_SET(signal_pipe, &rfds);
-               DSS_DEBUG_LOG("tvp: %p, tv_sec : %lu\n", tvp, (long unsigned) tv.tv_sec);
                ret = dss_select(signal_pipe + 1, &rfds, NULL, tvp);
                if (ret < 0)
                        goto out;
@@ -1121,7 +1126,10 @@ static int select_loop(void)
                                free_rsync_argv(rsync_argv);
                                create_rsync_argv(&rsync_argv, &current_snapshot_creation_time);
                        }
-                       /* fall through */
+                       ret = create_snapshot(rsync_argv);
+                       if (ret < 0)
+                               goto out;
+                       continue;
                case HS_NEEDS_RESTART:
                        if (!next_snapshot_is_due())
                                continue;