- if (pid == rsync_pid)
- return handle_rsync_exit(status);
- if (pid == rm_pid)
- return handle_rm_exit(status);
- if (pid == pre_create_hook_pid)
- return handle_pre_create_hook_exit(status);
- if (pid == post_create_hook_pid) {
- snapshot_creation_status = SCS_READY;
- compute_next_snapshot_time();
- return 1;
+
+ if (pid == create_pid) {
+ switch (snapshot_creation_status) {
+ case SCS_PRE_HOOK_RUNNING:
+ return handle_pre_create_hook_exit(status);
+ case SCS_RSYNC_RUNNING:
+ return handle_rsync_exit(status);
+ case SCS_POST_HOOK_RUNNING:
+ snapshot_creation_status = SCS_READY;
+ compute_next_snapshot_time();
+ return 1;
+ default:
+ DSS_EMERG_LOG("BUG: create can't die in status %d\n",
+ snapshot_creation_status);
+ return -E_BUG;
+ }