Commit 428edade authored by David Howells's avatar David Howells

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: d001648e ("rxrpc: Don't expose skbs to in-kernel users [ver #2]")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 68251f0a
...@@ -133,21 +133,10 @@ bool afs_cm_incoming_call(struct afs_call *call) ...@@ -133,21 +133,10 @@ bool afs_cm_incoming_call(struct afs_call *call)
} }
/* /*
* clean up a cache manager call * Clean up a cache manager call.
*/ */
static void afs_cm_destructor(struct afs_call *call) static void afs_cm_destructor(struct afs_call *call)
{ {
_enter("");
/* Break the callbacks here so that we do it after the final ACK is
* received. The step number here must match the final number in
* afs_deliver_cb_callback().
*/
if (call->cm_server && call->unmarshall == 5) {
ASSERT(call->count && call->request);
afs_break_callbacks(call->cm_server, call->count, call->request);
}
kfree(call->buffer); kfree(call->buffer);
call->buffer = NULL; call->buffer = NULL;
} }
...@@ -161,15 +150,14 @@ static void SRXAFSCB_CallBack(struct work_struct *work) ...@@ -161,15 +150,14 @@ static void SRXAFSCB_CallBack(struct work_struct *work)
_enter(""); _enter("");
/* be sure to send the reply *before* attempting to spam the AFS server /* We need to break the callbacks before sending the reply as the
* with FSFetchStatus requests on the vnodes with broken callbacks lest * server holds up change visibility till it receives our reply so as
* the AFS server get into a vicious cycle of trying to break further * to maintain cache coherency.
* callbacks because it hadn't received completion of the CBCallBack op */
* yet */
afs_send_empty_reply(call);
if (call->cm_server) if (call->cm_server)
afs_break_callbacks(call->cm_server, call->count, call->request); afs_break_callbacks(call->cm_server, call->count, call->request);
afs_send_empty_reply(call);
afs_put_call(call); afs_put_call(call);
_leave(""); _leave("");
} }
...@@ -267,15 +255,6 @@ static int afs_deliver_cb_callback(struct afs_call *call) ...@@ -267,15 +255,6 @@ static int afs_deliver_cb_callback(struct afs_call *call)
call->offset = 0; call->offset = 0;
call->unmarshall++; call->unmarshall++;
/* Record that the message was unmarshalled successfully so
* that the call destructor can know do the callback breaking
* work, even if the final ACK isn't received.
*
* If the step number changes, then afs_cm_destructor() must be
* updated also.
*/
call->unmarshall++;
case 5: case 5:
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment