@@ -149,7 +149,13 @@ struct list_head {
struct lstcon_rpc_ent {
struct list_head rpe_link; /* link chain */
struct lnet_process_id rpe_peer; /* peer's id */
- struct timeval rpe_stamp; /* time stamp of RPC */
+ /* This has not been used since Lustre 2.2 so its safe to use.
+ * Update to allow future use of timespec64
+ */
+ struct {
+ __s64 tv_sec;
+ __s64 tv_nsec;
+ } rpe_stamp; /* time stamp of RPC */
int rpe_state; /* peer's state */
int rpe_rpc_errno; /* RPC errno */
@@ -961,7 +961,7 @@ struct identity_downcall_data {
struct sepol_downcall_data {
__u32 sdd_magic;
- __kernel_time_t sdd_sepol_mtime;
+ __s64 sdd_sepol_mtime;
__u16 sdd_sepol_len;
char sdd_sepol[0];
};
@@ -50,8 +50,6 @@
int rc;
long jiffies_left = timeout * HZ;
unsigned long then;
- struct timeval tv;
- struct __kernel_sock_timeval ktv;
struct kvec iov = {
.iov_base = buffer,
.iov_len = nob
@@ -67,17 +65,12 @@
for (;;) {
msg.msg_flags = !timeout ? MSG_DONTWAIT : 0;
if (timeout) {
+ struct sock *sk = sock->sk;
+
/* Set send timeout to remaining time */
- jiffies_to_timeval(jiffies_left, &tv);
- ktv.tv_sec = tv.tv_sec;
- ktv.tv_usec = tv.tv_usec;
- rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO_NEW,
- (char *)&ktv, sizeof(ktv));
- if (rc) {
- CERROR("Can't set socket send timeout %ld.%06d: %d\n",
- (long)tv.tv_sec, (int)tv.tv_usec, rc);
- return rc;
- }
+ lock_sock(sk);
+ sk->sk_sndtimeo = jiffies_left;
+ release_sock(sk);
}
then = jiffies;
@@ -108,8 +101,6 @@
int rc;
long jiffies_left = timeout * HZ;
unsigned long then;
- struct timeval tv;
- struct __kernel_sock_timeval ktv;
struct kvec iov = {
.iov_base = buffer,
.iov_len = nob
@@ -124,17 +115,12 @@
iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, nob);
for (;;) {
+ struct sock *sk = sock->sk;
+
/* Set receive timeout to remaining time */
- jiffies_to_timeval(jiffies_left, &tv);
- ktv.tv_sec = tv.tv_sec;
- ktv.tv_usec = tv.tv_usec;
- rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO_NEW,
- (char *)&ktv, sizeof(ktv));
- if (rc) {
- CERROR("Can't set socket recv timeout %ld.%06d: %d\n",
- (long)tv.tv_sec, (int)tv.tv_usec, rc);
- return rc;
- }
+ lock_sock(sk);
+ sk->sk_rcvtimeo = jiffies_left;
+ release_sock(sk);
then = jiffies;
rc = sock_recvmsg(sock, &msg, 0);
@@ -38,7 +38,6 @@
*/
#include <linux/lnet/lib-lnet.h>
-#include <uapi/linux/lnet/lnetst.h>
#include "console.h"
static int
@@ -474,7 +474,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,
struct lstcon_rpc *crpc;
struct srpc_msg *msg;
struct lstcon_node *nd;
- struct timeval tv;
+ struct timespec64 ts;
int error;
s64 dur;
@@ -501,11 +501,11 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,
dur = crpc->crp_stamp_ns -
console_session.ses_id.ses_stamp * NSEC_PER_MSEC;
- tv = ns_to_timeval(dur);
+ ts = ns_to_timespec64(dur);
if (copy_to_user(&ent->rpe_peer, &nd->nd_id,
sizeof(struct lnet_process_id)) ||
- copy_to_user(&ent->rpe_stamp, &tv, sizeof(tv)) ||
+ copy_to_user(&ent->rpe_stamp, &ts, sizeof(ts)) ||
copy_to_user(&ent->rpe_state, &nd->nd_state,
sizeof(nd->nd_state)) ||
copy_to_user(&ent->rpe_rpc_errno, &error,
@@ -41,7 +41,6 @@
#define __LST_CONRPC_H__
#include <linux/lnet/lib-types.h>
-#include <uapi/linux/lnet/lnetst.h>
#include "rpc.h"
#include "selftest.h"
@@ -41,7 +41,6 @@
#define __LST_CONSOLE_H__
#include <linux/lnet/lib-types.h>
-#include <uapi/linux/lnet/lnetst.h>
#include "selftest.h"
#include "conrpc.h"