Whamcloud - gitweb
Branch b1_8
authoradilger <adilger>
Sat, 20 Dec 2008 00:39:00 +0000 (00:39 +0000)
committeradilger <adilger>
Sat, 20 Dec 2008 00:39:00 +0000 (00:39 +0000)
Avoid overflow due to 32-bit time_t in ptlrpc_init_xid().
b=2066

lustre/ptlrpc/client.c

index 0d4c0a9..fb16181 100644 (file)
@@ -2330,7 +2330,7 @@ static spinlock_t ptlrpc_last_xid_lock;
  * NOT want to have an XID per target or similar.
  *
  * To avoid an unlikely collision between match bits after a client reboot
- * (which would cause old to be delivered into the wrong buffer) we initialize
+ * (which would deliver old data into the wrong RDMA buffer) we initialize
  * the XID based on the current time, assuming a maximum RPC rate of 1M RPC/s.
  * If the time is clearly incorrect, we instead use a 62-bit random number.
  * In the worst case the random number will overflow 1M RPCs per second in
@@ -2347,7 +2347,7 @@ void ptlrpc_init_xid(void)
                 ptlrpc_last_xid >>= 2;
                 ptlrpc_last_xid |= (1ULL << 61);
         } else {
-                ptlrpc_last_xid = (now << 20);
+                ptlrpc_last_xid = (__u64)now << 20;
         }
 }