gc.c (41be702a542a0d14bb0b1c16e824fa9ed27616ec) | gc.c (743162013d40ca612b4cb53d3a200dff2d9ab26e) |
---|---|
1/* Key garbage collector 2 * 3 * Copyright (C) 2009-2011 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public Licence 8 * as published by the Free Software Foundation; either version --- 78 unchanged lines hidden (view full) --- 87static void key_gc_timer_func(unsigned long data) 88{ 89 kenter(""); 90 key_gc_next_run = LONG_MAX; 91 key_schedule_gc_links(); 92} 93 94/* | 1/* Key garbage collector 2 * 3 * Copyright (C) 2009-2011 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public Licence 8 * as published by the Free Software Foundation; either version --- 78 unchanged lines hidden (view full) --- 87static void key_gc_timer_func(unsigned long data) 88{ 89 kenter(""); 90 key_gc_next_run = LONG_MAX; 91 key_schedule_gc_links(); 92} 93 94/* |
95 * wait_on_bit() sleep function for uninterruptible waiting 96 */ 97static int key_gc_wait_bit(void *flags) 98{ 99 schedule(); 100 return 0; 101} 102 103/* | |
104 * Reap keys of dead type. 105 * 106 * We use three flags to make sure we see three complete cycles of the garbage 107 * collector: the first to mark keys of that type as being dead, the second to 108 * collect dead links and the third to clean up the dead keys. We have to be 109 * careful as there may already be a cycle in progress. 110 * 111 * The caller must be holding key_types_sem. --- 6 unchanged lines hidden (view full) --- 118 set_bit(KEY_GC_REAPING_KEYTYPE, &key_gc_flags); 119 smp_mb(); 120 set_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags); 121 122 kdebug("schedule"); 123 schedule_work(&key_gc_work); 124 125 kdebug("sleep"); | 95 * Reap keys of dead type. 96 * 97 * We use three flags to make sure we see three complete cycles of the garbage 98 * collector: the first to mark keys of that type as being dead, the second to 99 * collect dead links and the third to clean up the dead keys. We have to be 100 * careful as there may already be a cycle in progress. 101 * 102 * The caller must be holding key_types_sem. --- 6 unchanged lines hidden (view full) --- 109 set_bit(KEY_GC_REAPING_KEYTYPE, &key_gc_flags); 110 smp_mb(); 111 set_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags); 112 113 kdebug("schedule"); 114 schedule_work(&key_gc_work); 115 116 kdebug("sleep"); |
126 wait_on_bit(&key_gc_flags, KEY_GC_REAPING_KEYTYPE, key_gc_wait_bit, | 117 wait_on_bit(&key_gc_flags, KEY_GC_REAPING_KEYTYPE, |
127 TASK_UNINTERRUPTIBLE); 128 129 key_gc_dead_keytype = NULL; 130 kleave(""); 131} 132 133/* 134 * Garbage collect a list of unreferenced, detached keys --- 233 unchanged lines hidden --- | 118 TASK_UNINTERRUPTIBLE); 119 120 key_gc_dead_keytype = NULL; 121 kleave(""); 122} 123 124/* 125 * Garbage collect a list of unreferenced, detached keys --- 233 unchanged lines hidden --- |