From: Huiwen He <huiwen.he@linux.dev>
To: linkinjeon@kernel.org
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
senozhatsky@chromium.org, tom@talpey.com,
chenxiaosong@chenxiaosong.com, tj@kernel.org,
jiangshanlai@gmail.com, stefan.chulski@broadcom.com
Subject: [PATCH 2/4] ksmbd: reset the server directly on startup failure
Date: Tue, 1 Dec 2026 11:27:46 +0800 [thread overview]
Message-ID: <20261201032749.2224354-3-huiwen.he@linux.dev> (raw)
In-Reply-To: <20261201032749.2224354-1-huiwen.he@linux.dev>
From: Huiwen He <hehuiwen@kylinos.cn>
If transport initialization fails, ksmbd queues another control work
item to reset the server. If allocating that item fails, the server
never schedules the reset.
Return the initialization error to the control worker and run the
reset there while it still holds ctrl_lock.
Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
---
fs/smb/server/server.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
index 32a2201284f3..af3d2a81157a 100644
--- a/fs/smb/server/server.c
+++ b/fs/smb/server/server.c
@@ -596,19 +596,18 @@ static int server_conf_init(void)
return 0;
}
-static void server_ctrl_handle_init(struct server_ctrl_struct *ctrl)
+static int server_ctrl_handle_init(void)
{
int ret;
ksmbd_proc_reset();
ret = ksmbd_conn_transport_init();
- if (ret) {
- server_queue_ctrl_reset_work();
- return;
- }
+ if (ret)
+ return ret;
pr_info("running\n");
WRITE_ONCE(server_conf.state, SERVER_STATE_RUNNING);
+ return 0;
}
static void server_ctrl_handle_reset(struct server_ctrl_struct *ctrl)
@@ -630,7 +629,8 @@ static void server_ctrl_handle_work(struct work_struct *work)
mutex_lock(&ctrl_lock);
switch (ctrl->type) {
case SERVER_CTRL_TYPE_INIT:
- server_ctrl_handle_init(ctrl);
+ if (server_ctrl_handle_init())
+ server_ctrl_handle_reset(ctrl);
break;
case SERVER_CTRL_TYPE_RESET:
server_ctrl_handle_reset(ctrl);
next prev parent reply other threads:[~2026-12-01 3:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 3:27 [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue Huiwen He
2026-12-01 3:27 ` [PATCH 1/4] ksmbd: keep server in RESETTING until defaults are restored Huiwen He
2026-12-01 3:27 ` Huiwen He [this message]
2026-12-01 3:27 ` [PATCH 3/4] workqueue: export attribute and sysfs setup helpers Huiwen He
2026-12-01 3:27 ` [PATCH 4/4] ksmbd: add request workqueue mode startup option Huiwen He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201032749.2224354-3-huiwen.he@linux.dev \
--to=huiwen.he@linux.dev \
--cc=chenxiaosong@chenxiaosong.com \
--cc=jiangshanlai@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=stefan.chulski@broadcom.com \
--cc=tj@kernel.org \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox