arrfab / rpms / abrt

Forked from rpms/abrt 5 years ago
Clone

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

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