Commit d9f79e6b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

staging/lustre: use 64-bit time for selftest



The lustre selftest code has multiple time stamps that are kept
as 'time_t' or 'unsigned long' and can therefore overflow on
32-bit systems.

This changes the code to use time64_t instead.

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec0067d1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -134,14 +134,14 @@ brw_client_init(sfw_test_instance_t *tsi)
static int
brw_inject_one_error(void)
{
	struct timeval tv;
	struct timespec64 ts;

	if (brw_inject_errors <= 0)
		return 0;

	do_gettimeofday(&tv);
	ktime_get_ts64(&ts);

	if ((tv.tv_usec & 1) == 0)
	if (((ts.tv_nsec / NSEC_PER_USEC) & 1) == 0)
		return 0;

	return brw_inject_errors--;
+1 −1
Original line number Diff line number Diff line
@@ -837,7 +837,7 @@ lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data)

	mutex_lock(&console_session.ses_mutex);

	console_session.ses_laststamp = get_seconds();
	console_session.ses_laststamp = ktime_get_real_seconds();

	if (console_session.ses_shutdown) {
		rc = -ESHUTDOWN;
+7 −8
Original line number Diff line number Diff line
@@ -1176,7 +1176,7 @@ lstcon_rpc_pinger(void *arg)
	srpc_debug_reqst_t *drq;
	lstcon_ndlink_t *ndl;
	lstcon_node_t *nd;
	time_t intv;
	int intv;
	int count = 0;
	int rc;

@@ -1191,8 +1191,8 @@ lstcon_rpc_pinger(void *arg)
	}

	if (!console_session.ses_expired &&
	    get_seconds() - console_session.ses_laststamp >
	    (time_t)console_session.ses_timeout)
	    ktime_get_real_seconds() - console_session.ses_laststamp >
	    (time64_t)console_session.ses_timeout)
		console_session.ses_expired = 1;

	trans = console_session.ses_ping;
@@ -1248,9 +1248,8 @@ lstcon_rpc_pinger(void *arg)
		if (nd->nd_state != LST_NODE_ACTIVE)
			continue;

		intv = cfs_duration_sec(cfs_time_sub(cfs_time_current(),
						     nd->nd_stamp));
		if (intv < (time_t)nd->nd_timeout / 2)
		intv = (jiffies - nd->nd_stamp) / HZ;
		if (intv < nd->nd_timeout / 2)
			continue;

		rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG,
@@ -1278,7 +1277,7 @@ lstcon_rpc_pinger(void *arg)

	CDEBUG(D_NET, "Ping %d nodes in session\n", count);

	ptimer->stt_expires = (unsigned long)(get_seconds() + LST_PING_INTERVAL);
	ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
	stt_add_timer(ptimer);

	mutex_unlock(&console_session.ses_mutex);
@@ -1301,7 +1300,7 @@ lstcon_rpc_pinger_start(void)
	}

	ptimer = &console_session.ses_ping_timer;
	ptimer->stt_expires = (unsigned long)(get_seconds() + LST_PING_INTERVAL);
	ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;

	stt_add_timer(ptimer);

+1 −1
Original line number Diff line number Diff line
@@ -2004,7 +2004,7 @@ lstcon_console_init(void)
	console_session.ses_expired	  = 0;
	console_session.ses_feats_updated = 0;
	console_session.ses_features	  = LST_FEATS_MASK;
	console_session.ses_laststamp	  = get_seconds();
	console_session.ses_laststamp	  = ktime_get_real_seconds();

	mutex_init(&console_session.ses_mutex);

+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ typedef struct {
	int                 ses_key;          /* local session key */
	int                 ses_state;        /* state of session */
	int                 ses_timeout;      /* timeout in seconds */
	time_t              ses_laststamp;    /* last operation stamp (seconds)
	time64_t            ses_laststamp;    /* last operation stamp (seconds)
					       */
	unsigned            ses_features;     /* tests features of the session
					       */
Loading