Whamcloud - gitweb
LU-9859 libcfs: replace cfs_rand() with prandom_u32_max()
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index 91910a9..d646c7f 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <linux/module.h>
 #include <linux/kthread.h>
+#include <linux/random.h>
 
 #include <dt_object.h>
 #include <lprocfs_status.h>
@@ -611,7 +612,7 @@ static void do_requeue(struct config_llog_data *cld)
  * in order to not flood the MGS.
  */
 #define MGC_TIMEOUT_MIN_SECONDS   5
-#define MGC_TIMEOUT_RAND_CENTISEC 0x1ff /* ~500 */
+#define MGC_TIMEOUT_RAND_CENTISEC 500
 
 static int mgc_requeue_thread(void *data)
 {
@@ -627,7 +628,7 @@ static int mgc_requeue_thread(void *data)
        while (!(rq_state & RQ_STOP)) {
                struct l_wait_info lwi;
                struct config_llog_data *cld, *cld_prev;
-               int rand = cfs_rand() & MGC_TIMEOUT_RAND_CENTISEC;
+               int rand = prandom_u32_max(MGC_TIMEOUT_RAND_CENTISEC);
                int to;
 
                /* Any new or requeued lostlocks will change the state */