The krpc connect msg could still be in the input queue of rpc
when the rpc is being destroyed due to unpredictable execution
order of the rpc_qeue_work and rpc_close_work. The close work
can run before the queue work even though the queue work is
scheduled before the close work.

Non-empty input queue triggers the BUG_ON check in pcs_rpc_destroy.
So we need clean up the input queue on fatal abort.

Related to #VSTOR-96876
https://virtuozzo.atlassian.net/browse/VSTOR-96876

Signed-off-by: Liu Kui <kui....@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_rpc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index 9d782b6bea93..5557fc2fc9eb 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -207,6 +207,11 @@ void rpc_abort(struct pcs_rpc * ep, int fatal, int error)
                msg->stage = PCS_MSG_STAGE_NONE;
        }
        if (fatal) {
+               /* cleanup the input_queue */
+               spin_lock(&ep->q_lock);
+               list_splice_tail_init(&ep->input_queue, &failed_list);
+               spin_unlock(&ep->q_lock);
+
                while (!list_empty(&ep->state_queue)) {
                        struct pcs_msg * msg = 
list_first_entry(&ep->state_queue, struct pcs_msg, list);
                        list_move_tail(&msg->list, &failed_list);
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to