Re: [PATCH v2 3/3] smb/server: stop new async work when closing connection
Namjae Jeon <[email protected]>
| Newsgroups | org.kernel.vger.linux-cifs |
|---|---|
| Message-ID | <CAKYAXd-UsvUOK6A_8k8pdtYXANKeve+yDpVwXyRFa0wpyQ=nRw@mail.gmail.com> |
On Thu, Jul 16, 2026 at 9:12 AM ChenXiaoSong <[email protected]> wrote: > > From: ChenXiaoSong <[email protected]> > > A new async request may be added while a connection is closing. > The close code may miss this request and wait forever. > > Check the connection state before adding the request. Return an error > and release the async ID if the connection is closing. setup_async_work() protects only work items registered through that helper. However, smb2_notify() later creates a synthetic in_work and adds it directly to conn->async_requests. Therefore, the connection-close path can finish scanning and cancelling the existing async requests before in_work is added. in_work is then registered after the connection enters the releasing state and is not cancelled. So, we need to protect this direct registration with the same connection-state check, or use a common helper for all async request registrations. Thanks!