Blame SOURCES/0246-handle-event-stop-creating-post-create-lock.patch

06486d
From 44cb33f417d62210759c1730ca13bb03165c47ad Mon Sep 17 00:00:00 2001
06486d
From: Jakub Filak <jfilak@redhat.com>
06486d
Date: Tue, 19 Jul 2016 20:33:06 +0200
06486d
Subject: [PATCH] handle-event: stop creating post-create lock
06486d
06486d
Since the post-create synchronization has been moved to abrtd and
06486d
abrt-server, there is no need to crate the post-create.lock file.
06486d
06486d
Resolves #1132459
06486d
06486d
Signed-off-by: Jakub Filak <jfilak@redhat.com>
06486d
---
06486d
 src/daemon/abrt-handle-event.c | 58 ------------------------------------------
06486d
 1 file changed, 58 deletions(-)
06486d
06486d
diff --git a/src/daemon/abrt-handle-event.c b/src/daemon/abrt-handle-event.c
06486d
index 8870901..caed577 100644
06486d
--- a/src/daemon/abrt-handle-event.c
06486d
+++ b/src/daemon/abrt-handle-event.c
06486d
@@ -318,51 +318,6 @@ end:
06486d
     return retval;
06486d
 }
06486d
 
06486d
-static void create_lockfile(void)
06486d
-{
06486d
-    char pid_str[sizeof(long)*3 + 4];
06486d
-    sprintf(pid_str, "%lu", (long)getpid());
06486d
-    char *lock_filename = concat_path_file(g_settings_dump_location, "post-create.lock");
06486d
-
06486d
-    /* Someone else's post-create may take a long-ish time to finish.
06486d
-     * For example, I had a failing email sending there, it took
06486d
-     * a minute to time out.
06486d
-     * That's why timeout is large (100 seconds):
06486d
-     */
06486d
-    int count = 100;
06486d
-    while (1)
06486d
-    {
06486d
-        /* Return values:
06486d
-         * -1: error (in this case, errno is 0 if error message is already logged)
06486d
-         *  0: failed to lock (someone else has it locked)
06486d
-         *  1: success
06486d
-         */
06486d
-        int r = create_symlink_lockfile(lock_filename, pid_str);
06486d
-    if (r > 0)
06486d
-            break;
06486d
-    if (r < 0)
06486d
-            error_msg_and_die("Can't create '%s'", lock_filename);
06486d
-    if (--count == 0)
06486d
-        {
06486d
-            /* Someone else's post-create process is alive but stuck.
06486d
-             * Don't wait forever.
06486d
-             */
06486d
-            error_msg("Stale lock '%s', removing it", lock_filename);
06486d
-            xunlink(lock_filename);
06486d
-            break;
06486d
-        }
06486d
-        sleep(1);
06486d
-    }
06486d
-    free(lock_filename);
06486d
-}
06486d
-
06486d
-static void delete_lockfile(void)
06486d
-{
06486d
-    char *lock_filename = concat_path_file(g_settings_dump_location, "post-create.lock");
06486d
-    xunlink(lock_filename);
06486d
-    free(lock_filename);
06486d
-}
06486d
-
06486d
 static char *do_log(char *log_line, void *param)
06486d
 {
06486d
     /* We pipe output of events to our log.
06486d
@@ -428,23 +383,10 @@ int main(int argc, char **argv)
06486d
             make_run_event_state_forwarding(run_state);
06486d
         run_state->logging_callback = do_log;
06486d
         if (post_create)
06486d
-        {
06486d
             run_state->post_run_callback = is_crash_a_dup;
06486d
-            /*
06486d
-             * The post-create event cannot be run concurrently for more problem
06486d
-             * directories. The problem is in searching for duplicates process
06486d
-             * in case when two concurrently processed directories are duplicates
06486d
-             * of each other. Both of the directories are marked as duplicates
06486d
-             * of each other and are deleted.
06486d
-             */
06486d
-            create_lockfile();
06486d
-        }
06486d
 
06486d
         int r = run_event_on_dir_name(run_state, dump_dir_name, event_name);
06486d
 
06486d
-        if (post_create)
06486d
-            delete_lockfile();
06486d
-
06486d
         const bool no_action_for_event = (r == 0 && run_state->children_count == 0);
06486d
 
06486d
         free_run_event_state(run_state);
06486d
-- 
06486d
1.8.3.1
06486d