1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
diff --git src/vmware-server-distrib/lib/modules/source/vsock-only/linux/af_vsock.c newsrc/vmware-server-distrib/lib/modules/source/vsock-only/linux/af_vsock.c
index cdd9d59..0846eeb 100644
--- src/vmware-server-distrib/lib/modules/source/vsock-only/linux/af_vsock.c
+++ newsrc/vmware-server-distrib/lib/modules/source/vsock-only/linux/af_vsock.c
@@ -3149,7 +3149,7 @@ VSockVmciStreamConnect(struct socket *so
     * a notification of an error.
     */
    timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
       if (timeout == 0) {
@@ -3172,7 +3172,7 @@ VSockVmciStreamConnect(struct socket *so
          goto outWaitError;
       }

-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }

    if (sk->compat_sk_err) {
@@ -3184,7 +3184,7 @@ VSockVmciStreamConnect(struct socket *so
    }

 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -3244,7 +3244,7 @@ VSockVmciAccept(struct socket *sock,
     * upon connection establishment.
     */
    timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);

    while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
           listener->compat_sk_err == 0) {
@@ -3260,7 +3260,7 @@ VSockVmciAccept(struct socket *sock,
          goto outWait;
       }

-      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
    }

    if (listener->compat_sk_err) {
@@ -3294,7 +3294,7 @@ VSockVmciAccept(struct socket *sock,
    }

 outWait:
-   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
 out:
    release_sock(listener);
    return err;
@@ -3391,7 +3391,7 @@ VSockVmciPoll(struct file *file,    // I

    sk = sock->sk;

-   poll_wait(file, sk->compat_sk_sleep, wait);
+   poll_wait(file, compat_sk_sleep(sk), wait);
    mask = 0;

    if (sk->compat_sk_err) {
@@ -3992,7 +3992,7 @@ VSockVmciStreamSendmsg(struct kiocb *kio
     * Wait for room in the produce queue to enqueue our user's data.
     */
    timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while (totalWritten < len) {
       Bool sentWrote;
@@ -4031,7 +4031,7 @@ VSockVmciStreamSendmsg(struct kiocb *kio
             goto outWait;
          }

-         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
+         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
                                      &wait, TASK_INTERRUPTIBLE);
       }

@@ -4114,7 +4114,7 @@ outWait:
    if (totalWritten > 0) {
       err = totalWritten;
    }
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -4337,7 +4337,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kio
    timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
    copied = 0;

-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while ((ready = VMCIQueue_BufReady(vsk->consumeQ,
                                       vsk->produceQ,
@@ -4380,7 +4380,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kio
          goto outWait;
       }

-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }

    if (sk->compat_sk_err) {
@@ -4472,7 +4472,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kio
    err = copied;

 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
diff --git src/vmware-server-distrib/lib/modules/source/vsock-only/include/compat_sock.h newsrc/vmware-server-distrib/lib/modules/source/vsock-only/include/compat_sock.h
index 6969c0c..ba4d048 100644
--- src/vmware-server-distrib/lib/modules/source/vsock-only/include/compat_sock.h
+++ newsrc/vmware-server-distrib/lib/modules/source/vsock-only/include/compat_sock.h
@@ -43,7 +43,7 @@
 # define compat_sk_destruct             destruct
 # define compat_sk_shutdown             shutdown
 # define compat_sk_receive_queue        receive_queue
-# define compat_sk_sleep                sleep
+# define compat_sk_sleep(sk)            sk->sleep
 # define compat_sk_err                  err
 # define compat_sk_state_change         state_change
 # define compat_sk_data_ready           data_ready
@@ -61,7 +61,11 @@
 # define compat_sk_destruct             sk_destruct
 # define compat_sk_shutdown             sk_shutdown
 # define compat_sk_receive_queue        sk_receive_queue
-# define compat_sk_sleep                sk_sleep
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+# define compat_sk_sleep(sk)            sk->sk_sleep
+#else
+# define compat_sk_sleep(sk)            sk_sleep(sk)
+#endif
 # define compat_sk_err                  sk_err
 # define compat_sk_state_change         sk_state_change
 # define compat_sk_data_ready           sk_data_ready