[RESEND,3/4] fuse kio: Move abort & destroy block up in pcs_rpc_send()

Submitted by Kirill Tkhai on Oct. 17, 2018, 9:08 a.m.

Details

Message ID 153976729284.29624.2471827113172995977.stgit@localhost.localdomain
State New
Series "Order rpc destroy with rpc_queue_work()"
Headers show

Commit Message

Kirill Tkhai Oct. 17, 2018, 9:08 a.m.
On destruction we want to silently done all messages
with error, and immediately return from work. But
above pcs_rpc_get(ep) prevents to implement fine flush
on destruction, since there we have finally decremented
counter.

Previous patch tought all potential places, which may
touch msg->rpc from their msg->done callbacks, to skip
doing this in case of msg->rpc is NULL. So, here we
moves abort & destroy block at the top of function and
avoid doing pcs_rpc_get() for them.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_rpc.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index 8c76bb44f0a2..0717eeb6e99f 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -632,6 +632,13 @@  static void pcs_rpc_send(struct pcs_rpc * ep, struct pcs_msg * msg, bool requeue
 
 	TRACE("ENTER ep:%p state:%d msg:%p\n", ep, ep->state, msg);
 
+	if (ep->state == PCS_RPC_ABORT || ep->state == PCS_RPC_DESTROY) {
+		pcs_set_rpc_error(&msg->error, PCS_ERR_NET_ABORT, ep);
+		pcs_msg_del_calendar(msg);
+		msg->done(msg);
+		return;
+	}
+
 	if (!requeue) {
 		msg->rpc = pcs_rpc_get(ep);
 		if (msg->timeout) {
@@ -654,13 +661,6 @@  static void pcs_rpc_send(struct pcs_rpc * ep, struct pcs_msg * msg, bool requeue
 		return;
 	}
 
-	if (ep->state == PCS_RPC_ABORT || ep->state == PCS_RPC_DESTROY) {
-		pcs_set_rpc_error(&msg->error, PCS_ERR_NET_ABORT, ep);
-		pcs_msg_del_calendar(msg);
-		msg->done(msg);
-		return;
-	}
-
 	list_add_tail(&msg->list, &ep->state_queue);
 	msg->stage = PCS_MSG_STAGE_UNSENT;