Skip to content

Commit 428edad

Browse files
committed
afs: Fix CB.CallBack handling
The handling of CB.CallBack messages sent by the fileserver to the client is broken in that they are currently being processed after the reply has been transmitted. This is not what the fileserver expects, however. It holds up change visibility until the reply comes so as to maintain cache coherency, and so expects the client to have to refetch the state on the affected files. Fix CB.CallBack handling to perform the callback break before sending the reply. The fileserver is free to hold up status fetches issued by other threads on the same client that occur in reponse to the callback until any pending changes have been committed. Fixes: d001648 ("rxrpc: Don't expose skbs to in-kernel users [ver #2]") Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 68251f0 commit 428edad

1 file changed

Lines changed: 7 additions & 28 deletions

File tree

fs/afs/cmservice.c

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,10 @@ bool afs_cm_incoming_call(struct afs_call *call)
133133
}
134134

135135
/*
136-
* clean up a cache manager call
136+
* Clean up a cache manager call.
137137
*/
138138
static void afs_cm_destructor(struct afs_call *call)
139139
{
140-
_enter("");
141-
142-
/* Break the callbacks here so that we do it after the final ACK is
143-
* received. The step number here must match the final number in
144-
* afs_deliver_cb_callback().
145-
*/
146-
if (call->cm_server && call->unmarshall == 5) {
147-
ASSERT(call->count && call->request);
148-
afs_break_callbacks(call->cm_server, call->count, call->request);
149-
}
150-
151140
kfree(call->buffer);
152141
call->buffer = NULL;
153142
}
@@ -161,15 +150,14 @@ static void SRXAFSCB_CallBack(struct work_struct *work)
161150

162151
_enter("");
163152

164-
/* be sure to send the reply *before* attempting to spam the AFS server
165-
* with FSFetchStatus requests on the vnodes with broken callbacks lest
166-
* the AFS server get into a vicious cycle of trying to break further
167-
* callbacks because it hadn't received completion of the CBCallBack op
168-
* yet */
169-
afs_send_empty_reply(call);
170-
153+
/* We need to break the callbacks before sending the reply as the
154+
* server holds up change visibility till it receives our reply so as
155+
* to maintain cache coherency.
156+
*/
171157
if (call->cm_server)
172158
afs_break_callbacks(call->cm_server, call->count, call->request);
159+
160+
afs_send_empty_reply(call);
173161
afs_put_call(call);
174162
_leave("");
175163
}
@@ -267,15 +255,6 @@ static int afs_deliver_cb_callback(struct afs_call *call)
267255

268256
call->offset = 0;
269257
call->unmarshall++;
270-
271-
/* Record that the message was unmarshalled successfully so
272-
* that the call destructor can know do the callback breaking
273-
* work, even if the final ACK isn't received.
274-
*
275-
* If the step number changes, then afs_cm_destructor() must be
276-
* updated also.
277-
*/
278-
call->unmarshall++;
279258
case 5:
280259
break;
281260
}

0 commit comments

Comments
 (0)