Re: [PATCH 2/3] smb/server: cancel async requests when closing connection

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Wed, Jul 15, 2026 at 01:55:12PM +0000, ChenXiaoSong wrote:

> An async request may still be waiting when a connection is closed.
> This can stop the connection from closing.
> 
> Cancel active async requests before waiting for them to finish.

...

> +static void ksmbd_conn_cancel_async_requests(struct ksmbd_conn *conn)
> +{
> +	struct ksmbd_work *work;
> +
> +	ksmbd_debug(CONN, "Cancel pending async requests on releasing connection\n");
> +	spin_lock(&conn->request_lock);

> +	list_for_each_entry(work, &conn->async_requests,
> +			    async_request_entry) {

It's perfectly a single line. Note, the strict mode is 80 characters
(inclusive), this line even one less, id est 79 characters.

> +		if (work->state != KSMBD_WORK_ACTIVE)
> +			continue;
> +
> +		ksmbd_debug(CONN, "Cancel async request id %d\n",
> +			    work->async_id);
> +		work->state = KSMBD_WORK_CANCELLED;
> +		if (work->cancel_fn)
> +			work->cancel_fn(work->cancel_argv);
> +	}
> +	spin_unlock(&conn->request_lock);
> +}

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.