[Devel] [PATCH VZ9] fs/fuse kio: cleanup the input queue of rpc on fatal abort

Alexey Kuznetsov kuznet at virtuozzo.com
Wed Dec 18 12:59:19 MSK 2024


Ack

On Tue, Dec 17, 2024 at 4:26 PM Liu Kui <kui.liu at virtuozzo.com> wrote:
>
> 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.liu at 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)



More information about the Devel mailing list