Whamcloud - gitweb
LU-8842 mdc: Make IT_OPEN take lookup bits lock
[fs/lustre-release.git] / lustre / ptlrpc / sec_gc.c
index c01dce0..583a2fd 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 
 #define DEBUG_SUBSYSTEM S_SEC
 
-#ifndef __KERNEL__
-#include <liblustre.h>
-#else
+#include <linux/kthread.h>
 #include <libcfs/libcfs.h>
-#endif
 
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
 #include <lustre_sec.h>
 
+#include "ptlrpc_internal.h"
+
 #define SEC_GC_INTERVAL (30 * 60)
 
-#ifdef __KERNEL__
 
 static struct mutex sec_gc_mutex;
 static spinlock_t sec_gc_list_lock;
@@ -75,12 +69,11 @@ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec)
         sec->ps_gc_next = cfs_time_current_sec() + sec->ps_gc_interval;
 
        spin_lock(&sec_gc_list_lock);
-       list_add_tail(&sec_gc_list, &sec->ps_gc_list);
+       list_add_tail(&sec->ps_gc_list, &sec_gc_list);
        spin_unlock(&sec_gc_list_lock);
 
        CDEBUG(D_SEC, "added sec %p(%s)\n", sec, sec->ps_policy->sp_name);
 }
-EXPORT_SYMBOL(sptlrpc_gc_add_sec);
 
 void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec)
 {
@@ -104,7 +97,6 @@ void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec)
 
        CDEBUG(D_SEC, "del sec %p(%s)\n", sec, sec->ps_policy->sp_name);
 }
-EXPORT_SYMBOL(sptlrpc_gc_del_sec);
 
 void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx)
 {
@@ -204,7 +196,9 @@ again:
                /* check ctx list again before sleep */
                sec_process_ctx_list();
 
-               lwi = LWI_TIMEOUT(SEC_GC_INTERVAL * HZ, NULL, NULL);
+               lwi = LWI_TIMEOUT(msecs_to_jiffies(SEC_GC_INTERVAL *
+                                                  MSEC_PER_SEC),
+                                 NULL, NULL);
                l_wait_event(thread->t_ctl_waitq,
                             thread_is_stopping(thread) ||
                             thread_is_signal(thread),
@@ -256,21 +250,3 @@ void sptlrpc_gc_fini(void)
        l_wait_event(sec_gc_thread.t_ctl_waitq,
                     thread_is_stopped(&sec_gc_thread), &lwi);
 }
-
-#else /* !__KERNEL__ */
-
-void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec)
-{
-}
-void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec)
-{
-}
-int sptlrpc_gc_init(void)
-{
-        return 0;
-}
-void sptlrpc_gc_fini(void)
-{
-}
-
-#endif /* __KERNEL__ */