Skip to content

Commit fe591b4

Browse files
committed
afs: Use the operation issue time instead of the reply time for callbacks
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author David Howells <dhowells@redhat.com> commit 7903192 rxrpc and kafs between them try to use the receive timestamp on the first data packet (ie. the one with sequence number 1) as a base from which to calculate the time at which callback promise and lock expiration occurs. However, we don't know how long it took for the server to send us the reply from it having completed the basic part of the operation - it might then, for instance, have to send a bunch of a callback breaks, depending on the particular operation. Fix this by using the time at which the operation is issued on the client as a base instead. That should never be longer than the server's idea of the expiry time. Fixes: 7810705 ("afs: Fix calculation of callback expiry time") Fixes: 2070a3e ("rxrpc: Allow the reply time to be obtained on a client call") Suggested-by: Jeffrey E Altman <jaltman@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com> (cherry picked from commit 7903192) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 4a02185 commit fe591b4

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

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);

0 commit comments

Comments
 (0)