Whamcloud - gitweb
LU-4423 ptlrpc: use 64-bit times for ptlrpc_sec 10/24710/3
authorArnd Bergmann <arnd@arndb.de>
Wed, 11 Jan 2017 01:50:19 +0000 (20:50 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Jan 2017 05:23:49 +0000 (05:23 +0000)
Here we use an unsigned long to store the timeout for gc,
which is probably safe until 2106, but this patch converts it
to use ktime_get_real_seconds() and time64_t for consistency.

Linux-commit: 8cc980713ec9e6847896891c54562ad815c33424

Change-Id: I9c66ac818239debe676b78fbee5764cd5b69028c
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24710
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/include/lustre_sec.h
lustre/ptlrpc/gss/gss_pipefs.c
lustre/ptlrpc/sec_gc.c
lustre/ptlrpc/sec_lproc.c

index a6cf264..1aaab85 100644 (file)
@@ -873,8 +873,8 @@ struct ptlrpc_sec {
         * garbage collection
         */
        struct list_head                ps_gc_list;
-       cfs_time_t                      ps_gc_interval; /* in seconds */
-       cfs_time_t                      ps_gc_next;     /* in seconds */
+       time64_t                        ps_gc_interval; /* in seconds */
+       time64_t                        ps_gc_next;     /* in seconds */
 };
 
 static inline int flvr_is_rootonly(__u32 flavor)
index af18762..016d455 100644 (file)
@@ -338,8 +338,8 @@ void gss_ctx_cache_gc_pf(struct gss_sec_pipefs *gsec_pf,
                         ctx_check_death_locked_pf(ctx, freelist);
         }
 
-        sec->ps_gc_next = cfs_time_current_sec() + sec->ps_gc_interval;
-        EXIT;
+       sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval;
+       EXIT;
 }
 
 static
@@ -440,12 +440,12 @@ struct ptlrpc_cli_ctx * gss_sec_lookup_ctx_pf(struct ptlrpc_sec *sec,
 retry:
        spin_lock(&sec->ps_lock);
 
-        /* gc_next == 0 means never do gc */
-        if (remove_dead && sec->ps_gc_next &&
-            cfs_time_after(cfs_time_current_sec(), sec->ps_gc_next)) {
-                gss_ctx_cache_gc_pf(gsec_pf, &freelist);
-                gc = 1;
-        }
+       /* gc_next == 0 means never do gc */
+       if (remove_dead && sec->ps_gc_next &&
+          (ktime_get_real_seconds() > sec->ps_gc_next)) {
+               gss_ctx_cache_gc_pf(gsec_pf, &freelist);
+               gc = 1;
+       }
 
         cfs_hlist_for_each_entry_safe(ctx, pos, next, hash_head, cc_cache) {
                 if (gc == 0 &&
@@ -950,7 +950,7 @@ void gss_pipe_destroy_msg(struct rpc_pipe_msg *msg)
 {
         struct gss_upcall_msg          *gmsg;
         struct gss_upcall_msg_data     *gumd;
-        static cfs_time_t               ratelimit = 0;
+       static time64_t ratelimit;
         ENTRY;
 
        LASSERT(list_empty(&msg->list));
@@ -973,9 +973,9 @@ void gss_pipe_destroy_msg(struct rpc_pipe_msg *msg)
        atomic_inc(&gmsg->gum_refcount);
        gss_unhash_msg(gmsg);
        if (msg->errno == -ETIMEDOUT || msg->errno == -EPIPE) {
-               cfs_time_t now = cfs_time_current_sec();
+               time64_t now = ktime_get_real_seconds();
 
-               if (cfs_time_after(now, ratelimit)) {
+               if (now > ratelimit) {
                        CWARN("upcall timed out, is lgssd running?\n");
                        ratelimit = now + 15;
                }
index c03eb0e..f8ec60b 100644 (file)
@@ -66,7 +66,7 @@ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec)
         LASSERT(sec->ps_gc_interval > 0);
        LASSERT(list_empty(&sec->ps_gc_list));
 
-        sec->ps_gc_next = cfs_time_current_sec() + sec->ps_gc_interval;
+       sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval;
 
        spin_lock(&sec_gc_list_lock);
        list_add_tail(&sec->ps_gc_list, &sec_gc_list);
@@ -149,11 +149,11 @@ static void sec_do_gc(struct ptlrpc_sec *sec)
 
         CDEBUG(D_SEC, "check on sec %p(%s)\n", sec, sec->ps_policy->sp_name);
 
-        if (cfs_time_after(sec->ps_gc_next, cfs_time_current_sec()))
+       if (sec->ps_gc_next > ktime_get_real_seconds())
                 return;
 
         sec->ps_policy->sp_cops->gc_ctx(sec);
-        sec->ps_gc_next = cfs_time_current_sec() + sec->ps_gc_interval;
+       sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval;
 }
 
 static int sec_gc_main(void *arg)
index 05a239b..96acb18 100644 (file)
@@ -101,10 +101,10 @@ static int sptlrpc_info_lprocfs_seq_show(struct seq_file *seq, void *v)
        seq_printf(seq, "refcount:      %d\n",
                   atomic_read(&sec->ps_refcount));
        seq_printf(seq, "nctx:  %d\n", atomic_read(&sec->ps_nctx));
-       seq_printf(seq, "gc internal    %ld\n", sec->ps_gc_interval);
-       seq_printf(seq, "gc next        %ld\n",
+       seq_printf(seq, "gc internal    %lld\n", sec->ps_gc_interval);
+       seq_printf(seq, "gc next        %lld\n",
                   sec->ps_gc_interval ?
-                  sec->ps_gc_next - cfs_time_current_sec() : 0);
+                  (s64)(sec->ps_gc_next - ktime_get_real_seconds()) : 0ll);
 
        sptlrpc_sec_put(sec);
 out: