Skip to content

Commit e7506d3

Browse files
committed
Merge tag 'rxrpc-fixes-20220901' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
David Howells says: ==================== rxrpc fixes Here are some fixes for AF_RXRPC: (1) Fix the handling of ICMP/ICMP6 packets. This is a problem due to rxrpc being switched to acting as a UDP tunnel, thereby allowing it to steal the packets before they go through the UDP Rx queue. UDP tunnels can't get ICMP/ICMP6 packets, however. This patch adds an additional encap hook so that they can. (2) Fix the encryption routines in rxkad to handle packets that have more than three parts correctly. The problem is that ->nr_frags doesn't count the initial fragment, so the sglist ends up too short. (3) Fix a problem with destruction of the local endpoint potentially getting repeated. (4) Fix the calculation of the time at which to resend. jiffies_to_usecs() gives microseconds, not nanoseconds. (5) Fix AFS to work out when callback promises and locks expire based on the time an op was issued rather than the time the first reply packet arrives. We don't know how long the server took between calculating the expiry interval and transmitting the reply. (6) Given (5), rxrpc_get_reply_time() is no longer used, so remove it. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 3261400 + 21457f4 commit e7506d3

File tree

18 files changed

+280
-108
lines changed

18 files changed

+280
-108
lines changed

Documentation/networking/rxrpc.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,17 +1055,6 @@ The kernel interface functions are as follows:
10551055
first function to change. Note that this must be called in TASK_RUNNING
10561056
state.
10571057

1058-
(#) Get reply timestamp::
1059-
1060-
bool rxrpc_kernel_get_reply_time(struct socket *sock,
1061-
struct rxrpc_call *call,
1062-
ktime_t *_ts)
1063-
1064-
This allows the timestamp on the first DATA packet of the reply of a
1065-
client call to be queried, provided that it is still in the Rx ring. If
1066-
successful, the timestamp will be stored into ``*_ts`` and true will be
1067-
returned; false will be returned otherwise.
1068-
10691058
(#) Get remote client epoch::
10701059

10711060
u32 rxrpc_kernel_get_epoch(struct socket *sock,

fs/afs/flock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void afs_lock_op_done(struct afs_call *call)
7676
if (call->error == 0) {
7777
spin_lock(&vnode->lock);
7878
trace_afs_flock_ev(vnode, NULL, afs_flock_timestamp, 0);
79-
vnode->locked_at = call->reply_time;
79+
vnode->locked_at = call->issue_time;
8080
afs_schedule_lock_extension(vnode);
8181
spin_unlock(&vnode->lock);
8282
}

fs/afs/fsclient.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
131131

132132
static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry)
133133
{
134-
return ktime_divns(call->reply_time, NSEC_PER_SEC) + expiry;
134+
return ktime_divns(call->issue_time, NSEC_PER_SEC) + expiry;
135135
}
136136

137137
static void xdr_decode_AFSCallBack(const __be32 **_bp,

fs/afs/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ struct afs_call {
137137
bool need_attention; /* T if RxRPC poked us */
138138
bool async; /* T if asynchronous */
139139
bool upgrade; /* T to request service upgrade */
140-
bool have_reply_time; /* T if have got reply_time */
141140
bool intr; /* T if interruptible */
142141
bool unmarshalling_error; /* T if an unmarshalling error occurred */
143142
u16 service_id; /* Actual service ID (after upgrade) */
@@ -151,7 +150,7 @@ struct afs_call {
151150
} __attribute__((packed));
152151
__be64 tmp64;
153152
};
154-
ktime_t reply_time; /* Time of first reply packet */
153+
ktime_t issue_time; /* Time of issue of operation */
155154
};
156155

157156
struct afs_call_type {

fs/afs/rxrpc.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
351351
if (call->max_lifespan)
352352
rxrpc_kernel_set_max_life(call->net->socket, rxcall,
353353
call->max_lifespan);
354+
call->issue_time = ktime_get_real();
354355

355356
/* send the request */
356357
iov[0].iov_base = call->request;
@@ -501,12 +502,6 @@ static void afs_deliver_to_call(struct afs_call *call)
501502
return;
502503
}
503504

504-
if (!call->have_reply_time &&
505-
rxrpc_kernel_get_reply_time(call->net->socket,
506-
call->rxcall,
507-
&call->reply_time))
508-
call->have_reply_time = true;
509-
510505
ret = call->type->deliver(call);
511506
state = READ_ONCE(call->state);
512507
if (ret == 0 && call->unmarshalling_error)

fs/afs/yfsclient.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ static void xdr_decode_YFSCallBack(const __be32 **_bp,
232232
struct afs_callback *cb = &scb->callback;
233233
ktime_t cb_expiry;
234234

235-
cb_expiry = call->reply_time;
236-
cb_expiry = ktime_add(cb_expiry, xdr_to_u64(x->expiration_time) * 100);
235+
cb_expiry = ktime_add(call->issue_time, xdr_to_u64(x->expiration_time) * 100);
237236
cb->expires_at = ktime_divns(cb_expiry, NSEC_PER_SEC);
238237
scb->have_cb = true;
239238
*_bp += xdr_size(x);

include/linux/udp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct udp_sock {
7070
* For encapsulation sockets.
7171
*/
7272
int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
73+
void (*encap_err_rcv)(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset);
7374
int (*encap_err_lookup)(struct sock *sk, struct sk_buff *skb);
7475
void (*encap_destroy)(struct sock *sk);
7576

include/net/af_rxrpc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
6666
void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
6767
bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
6868
u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
69-
bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
70-
ktime_t *);
7169
bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
7270
void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
7371
unsigned long);

include/net/udp_tunnel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ static inline int udp_sock_create(struct net *net,
6767
typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb);
6868
typedef int (*udp_tunnel_encap_err_lookup_t)(struct sock *sk,
6969
struct sk_buff *skb);
70+
typedef void (*udp_tunnel_encap_err_rcv_t)(struct sock *sk,
71+
struct sk_buff *skb,
72+
unsigned int udp_offset);
7073
typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk);
7174
typedef struct sk_buff *(*udp_tunnel_gro_receive_t)(struct sock *sk,
7275
struct list_head *head,
@@ -80,6 +83,7 @@ struct udp_tunnel_sock_cfg {
8083
__u8 encap_type;
8184
udp_tunnel_encap_rcv_t encap_rcv;
8285
udp_tunnel_encap_err_lookup_t encap_err_lookup;
86+
udp_tunnel_encap_err_rcv_t encap_err_rcv;
8387
udp_tunnel_encap_destroy_t encap_destroy;
8488
udp_tunnel_gro_receive_t gro_receive;
8589
udp_tunnel_gro_complete_t gro_complete;

net/ipv4/udp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ int __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable)
783783
*/
784784
if (tunnel) {
785785
/* ...not for tunnels though: we don't have a sending socket */
786+
if (udp_sk(sk)->encap_err_rcv)
787+
udp_sk(sk)->encap_err_rcv(sk, skb, iph->ihl << 2);
786788
goto out;
787789
}
788790
if (!inet->recverr) {

0 commit comments

Comments
 (0)