* [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue
@ 2026-12-01 3:27 Huiwen He
2026-12-01 3:27 ` [PATCH 1/4] ksmbd: keep server in RESETTING until defaults are restored Huiwen He
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Huiwen He @ 2026-12-01 3:27 UTC (permalink / raw)
To: linkinjeon
Cc: linux-cifs, linux-kernel, senozhatsky, tom, chenxiaosong, tj,
jiangshanlai, stefan.chulski
From: Huiwen He <hehuiwen@kylinos.cn>
ksmbd currently dispatches incoming requests to a per-CPU workqueue.
Pipelined writes on a single connection can leave the receive thread
and workers competing for the same CPU. An unbound workqueue lets
workers use other CPUs, but the cost of cross-CPU handoffs can outweigh
the gain from parallelism.
Patch 1 fixes a race that can let ksmbd accept a new startup request
before reset finishes restoring the server defaults.
Patch 2 handles startup failures in the current control work item, so
recovery does not depend on allocating another one.
Patch 3 exports the helpers needed to set CPU scope before sysfs
registration.
Patch 4 lets ksmbd.mountd select the workqueue for all incoming SMB
requests at server startup. With the companion ksmbd-tools patch,
administrators can set "server request workqueue = unbound" in
ksmbd.conf. The default is "percpu".
Single-channel fio throughput in MiB/s on tmpfs (schedutil, 128 CPUs,
16 jobs, iodepth 32, mixed 50/50 read/write). Both unbound scopes are
non-strict (shard = cache_shard); delta compares unbound (cpu) with
per-CPU.
Size I/O per-CPU unbound unbound delta
(shard) (cpu)
------------------------------------------------------------
4 KiB READ 294 182 243 -17.3%
4 KiB WRITE 251 178 177 -29.5%
4 KiB MIXED 263 146 199 -24.3%
64 KiB READ 2583 1791 2171 -15.9%
64 KiB WRITE 1640 1882 2013 +22.8%
64 KiB MIXED 2194 1503 1834 -16.4%
256 KiB READ 3119 3012 3127 +0.2%
256 KiB WRITE 2183 3155 3233 +48.1%
256 KiB MIXED 2906 3213 3239 +11.4%
1 MiB READ 3398 3259 3413 +0.5%
1 MiB WRITE 2047 3032 3091 +51.0%
1 MiB MIXED 2859 3367 3416 +19.5%
The October RFC explored using an unbound workqueue for selected
WRITE requests [1].
As a follow-up, I am looking into an adaptive mode that weighs the
benefits of parallelism against the costs of spreading work across
CPUs. The goal is to outperform both fixed modes on most workloads and
become the default.
[1] https://lore.kernel.org/r/20261022092514.2590010-1-huiwen.he@linux.dev
Huiwen He (4):
ksmbd: keep server in RESETTING until defaults are restored
ksmbd: reset the server directly on startup failure
workqueue: export attribute and sysfs setup helpers
ksmbd: add request workqueue mode startup option
fs/smb/server/ksmbd_netlink.h | 8 ++++-
fs/smb/server/ksmbd_work.c | 64 +++++++++++++++++++++++++++++++++--
fs/smb/server/ksmbd_work.h | 3 +-
fs/smb/server/server.c | 27 +++++++++------
fs/smb/server/server.h | 4 ++-
fs/smb/server/transport_ipc.c | 5 +++
kernel/workqueue.c | 4 +++
7 files changed, 100 insertions(+), 15 deletions(-)
base-commit: 87ff512becd45a08c44fd47a9f03e607af9ef6bd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] ksmbd: keep server in RESETTING until defaults are restored
2026-12-01 3:27 [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue Huiwen He
@ 2026-12-01 3:27 ` Huiwen He
2026-12-01 3:27 ` [PATCH 2/4] ksmbd: reset the server directly on startup failure Huiwen He
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Huiwen He @ 2026-12-01 3:27 UTC (permalink / raw)
To: linkinjeon
Cc: linux-cifs, linux-kernel, senozhatsky, tom, chenxiaosong, tj,
jiangshanlai, stefan.chulski
From: Huiwen He <hehuiwen@kylinos.cn>
server_ctrl_handle_reset() can expose STARTING_UP before reset finishes:
a failed init leaves the server in STARTING_UP when reset clears the
mountd PID, and server_conf_init() sets STARTING_UP before restoring
defaults. Either window lets a new mountd startup race with teardown
and default restoration.
Enter RESETTING before clearing the mountd PID, and publish STARTING_UP
with release/acquire ordering only after defaults are restored.
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 | 6 +++---
fs/smb/server/server.h | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
index 962f12e969ba..32a2201284f3 100644
--- a/fs/smb/server/server.c
+++ b/fs/smb/server/server.c
@@ -580,7 +580,6 @@ static void server_conf_free(void)
static int server_conf_init(void)
{
- WRITE_ONCE(server_conf.state, SERVER_STATE_STARTING_UP);
server_conf.enforced_signing = 0;
server_conf.min_protocol = ksmbd_min_protocol();
server_conf.max_protocol = ksmbd_max_protocol();
@@ -592,6 +591,8 @@ static int server_conf_init(void)
server_conf.max_inflight_req = SMB2_MAX_CREDITS;
server_conf.max_sessions_per_connection =
KSMBD_DEFAULT_MAX_SESSIONS_PER_CONNECTION;
+ /* Publish the defaults before accepting a mountd startup event. */
+ smp_store_release(&server_conf.state, SERVER_STATE_STARTING_UP);
return 0;
}
@@ -612,12 +613,12 @@ static void server_ctrl_handle_init(struct server_ctrl_struct *ctrl)
static void server_ctrl_handle_reset(struct server_ctrl_struct *ctrl)
{
+ WRITE_ONCE(server_conf.state, SERVER_STATE_RESETTING);
ksmbd_ipc_soft_reset();
ksmbd_conn_transport_destroy();
ksmbd_stop_durable_scavenger();
server_conf_free();
server_conf_init();
- WRITE_ONCE(server_conf.state, SERVER_STATE_STARTING_UP);
}
static void server_ctrl_handle_work(struct work_struct *work)
@@ -695,7 +696,6 @@ static ssize_t kill_server_store(const struct class *class,
pr_info("kill command received\n");
mutex_lock(&ctrl_lock);
- WRITE_ONCE(server_conf.state, SERVER_STATE_RESETTING);
__module_get(THIS_MODULE);
server_ctrl_handle_reset(NULL);
module_put(THIS_MODULE);
diff --git a/fs/smb/server/server.h b/fs/smb/server/server.h
index 7b7df3fafe5b..28704174d8df 100644
--- a/fs/smb/server/server.h
+++ b/fs/smb/server/server.h
@@ -72,7 +72,8 @@ static inline int ksmbd_server_running(void)
static inline int ksmbd_server_configurable(void)
{
- return READ_ONCE(server_conf.state) < SERVER_STATE_RESETTING;
+ /* Pairs with the release in server_conf_init(). */
+ return smp_load_acquire(&server_conf.state) < SERVER_STATE_RESETTING;
}
int server_queue_ctrl_init_work(void);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] ksmbd: reset the server directly on startup failure
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
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
3 siblings, 0 replies; 5+ messages in thread
From: Huiwen He @ 2026-12-01 3:27 UTC (permalink / raw)
To: linkinjeon
Cc: linux-cifs, linux-kernel, senozhatsky, tom, chenxiaosong, tj,
jiangshanlai, stefan.chulski
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);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] workqueue: export attribute and sysfs setup helpers
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 ` [PATCH 2/4] ksmbd: reset the server directly on startup failure Huiwen He
@ 2026-12-01 3:27 ` Huiwen He
2026-12-01 3:27 ` [PATCH 4/4] ksmbd: add request workqueue mode startup option Huiwen He
3 siblings, 0 replies; 5+ messages in thread
From: Huiwen He @ 2026-12-01 3:27 UTC (permalink / raw)
To: linkinjeon
Cc: linux-cifs, linux-kernel, senozhatsky, tom, chenxiaosong, tj,
jiangshanlai, stefan.chulski
From: Huiwen He <hehuiwen@kylinos.cn>
The workqueue attribute helpers are not available to modules.
Export the allocation, application and release helpers for GPL modules.
Also export workqueue_sysfs_register() so a module can apply attributes
before exposing its queue in sysfs.
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
---
kernel/workqueue.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a2a441837a9d..f525618afdb5 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5012,6 +5012,7 @@ void free_workqueue_attrs(struct workqueue_attrs *attrs)
kfree(attrs);
}
}
+EXPORT_SYMBOL_GPL(free_workqueue_attrs);
/**
* alloc_workqueue_attrs - allocate a workqueue_attrs
@@ -5040,6 +5041,7 @@ struct workqueue_attrs *alloc_workqueue_attrs_noprof(void)
free_workqueue_attrs(attrs);
return NULL;
}
+EXPORT_SYMBOL_GPL(alloc_workqueue_attrs_noprof);
static void copy_workqueue_attrs(struct workqueue_attrs *to,
const struct workqueue_attrs *from)
@@ -5878,6 +5880,7 @@ int apply_workqueue_attrs(struct workqueue_struct *wq,
return ret;
}
+EXPORT_SYMBOL_GPL(apply_workqueue_attrs);
/**
* unbound_wq_update_pwq - update a pwq slot for CPU hot[un]plug
@@ -8001,6 +8004,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD);
return 0;
}
+EXPORT_SYMBOL_GPL(workqueue_sysfs_register);
/**
* workqueue_sysfs_unregister - undo workqueue_sysfs_register()
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] ksmbd: add request workqueue mode startup option
2026-12-01 3:27 [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue Huiwen He
` (2 preceding siblings ...)
2026-12-01 3:27 ` [PATCH 3/4] workqueue: export attribute and sysfs setup helpers Huiwen He
@ 2026-12-01 3:27 ` Huiwen He
3 siblings, 0 replies; 5+ messages in thread
From: Huiwen He @ 2026-12-01 3:27 UTC (permalink / raw)
To: linkinjeon
Cc: linux-cifs, linux-kernel, senozhatsky, tom, chenxiaosong, tj,
jiangshanlai, stefan.chulski
From: Huiwen He <hehuiwen@kylinos.cn>
ksmbd currently dispatches incoming SMB requests to a per-CPU
workqueue, queueing each request on the CPU running the connection's
receive thread. This favors cache locality, but pipelined requests can
leave the receiver and workers competing for the same CPU.
An unbound workqueue allows a worker to process one request on another
CPU while the receive thread handles the next. This overlap can reduce
queueing and improve throughput, but cross-CPU costs may also outweigh
the gain. For example, small replies contend more on srv_mutex, and
spreading work can place workers on lower-frequency CPUs.
Since neither mode fits every workload, let ksmbd.mountd select the
request workqueue at server startup. The ksmbd.conf option
"server request workqueue" accepts "percpu" or "unbound". Leaving it
unset preserves the existing per-CPU behavior.
Use the last reserved byte of the startup request for the mode.
ksmbd.mountd already uses the first byte to advertise quota support.
For unbound dispatch, set the affinity scope to CPU before exposing
the queue in sysfs. This favors the CPU that queued the request while
allowing workers to run on other CPUs.
Single-channel fio throughput in MiB/s on tmpfs (schedutil, 128 CPUs,
16 jobs, iodepth 32, mixed 50/50). Both unbound scopes are non-strict
(shard = cache_shard); delta compares unbound (cpu) with per-CPU.
Size I/O per-CPU unbound unbound delta
(shard) (cpu)
------------------------------------------------------------
4 KiB READ 294 182 243 -17.3%
4 KiB WRITE 251 178 177 -29.5%
4 KiB MIXED 263 146 199 -24.3%
64 KiB READ 2583 1791 2171 -15.9%
64 KiB WRITE 1640 1882 2013 +22.8%
64 KiB MIXED 2194 1503 1834 -16.4%
256 KiB READ 3119 3012 3127 +0.2%
256 KiB WRITE 2183 3155 3233 +48.1%
256 KiB MIXED 2906 3213 3239 +11.4%
1 MiB READ 3398 3259 3413 +0.5%
1 MiB WRITE 2047 3032 3091 +51.0%
1 MiB MIXED 2859 3367 3416 +19.5%
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
---
fs/smb/server/ksmbd_netlink.h | 8 ++++-
fs/smb/server/ksmbd_work.c | 64 +++++++++++++++++++++++++++++++++--
fs/smb/server/ksmbd_work.h | 3 +-
fs/smb/server/server.c | 9 ++++-
fs/smb/server/server.h | 1 +
fs/smb/server/transport_ipc.c | 5 +++
6 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/fs/smb/server/ksmbd_netlink.h b/fs/smb/server/ksmbd_netlink.h
index ad050988659e..d47ac9237bdc 100644
--- a/fs/smb/server/ksmbd_netlink.h
+++ b/fs/smb/server/ksmbd_netlink.h
@@ -80,6 +80,11 @@ struct ksmbd_heartbeat {
#define KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF BIT(3)
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLE BIT(4)
+enum ksmbd_wq_mode {
+ KSMBD_WQ_PERCPU = 0,
+ KSMBD_WQ_UNBOUND = 1,
+};
+
/*
* IPC request for ksmbd server startup
*/
@@ -115,7 +120,8 @@ struct ksmbd_startup_request {
__u32 max_ip_connections; /* Number of maximum connection per ip address */
__s8 aapl_model[32]; /* AAPL model string for Finder icon, e.g. "Xserve" */
__u32 max_sessions_per_connection; /* Maximum sessions per connection */
- __s8 reserved[463]; /* Reserved room */
+ __s8 reserved[462]; /* Reserved room */
+ __u8 request_wq_mode; /* enum ksmbd_wq_mode */
__u32 ifc_list_sz; /* interfaces list size */
__s8 ____payload[];
} __packed;
diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
index ad576683493f..33e930a62b56 100644
--- a/fs/smb/server/ksmbd_work.c
+++ b/fs/smb/server/ksmbd_work.c
@@ -11,12 +11,15 @@
#include "server.h"
#include "connection.h"
#include "ksmbd_work.h"
+#include "ksmbd_netlink.h"
#include "vfs_cache.h"
#include "mgmt/ksmbd_ida.h"
static struct kmem_cache *work_cache;
static struct workqueue_struct *ksmbd_wq;
static struct workqueue_struct *ksmbd_break_wq;
+static struct workqueue_struct *ksmbd_unbound_wq;
+static struct workqueue_struct *ksmbd_req_wq;
static int ksmbd_reserve_iov(struct ksmbd_work *work, int need_iov_cnt)
{
@@ -114,6 +117,57 @@ int ksmbd_work_pool_init(void)
return 0;
}
+static int ksmbd_init_unbound_wq(void)
+{
+ struct workqueue_struct *wq;
+ struct workqueue_attrs *attrs;
+ int ret = -ENOMEM;
+
+ /* Reuse the queue on subsequent server starts. */
+ if (ksmbd_unbound_wq)
+ return 0;
+
+ wq = alloc_workqueue("ksmbd-io-unbound", WQ_UNBOUND, 0);
+ if (!wq)
+ return -ENOMEM;
+ attrs = alloc_workqueue_attrs();
+ if (!attrs)
+ goto destroy_unbound_wq;
+ attrs->affn_scope = WQ_AFFN_CPU;
+ attrs->affn_strict = false;
+ ret = apply_workqueue_attrs(wq, attrs);
+ free_workqueue_attrs(attrs);
+ if (ret)
+ goto destroy_unbound_wq;
+
+ /* Set the initial policy before exposing writable sysfs attributes. */
+ ret = workqueue_sysfs_register(wq);
+ if (ret)
+ goto destroy_unbound_wq;
+ ksmbd_unbound_wq = wq;
+ return 0;
+
+destroy_unbound_wq:
+ destroy_workqueue(wq);
+ return ret;
+}
+
+/* Called under ctrl_lock before starting listeners. */
+int ksmbd_prepare_request_wq(void)
+{
+ struct workqueue_struct *wq = ksmbd_wq;
+ int ret;
+
+ if (READ_ONCE(server_conf.request_wq_mode) == KSMBD_WQ_UNBOUND) {
+ ret = ksmbd_init_unbound_wq();
+ if (ret)
+ return ret;
+ wq = ksmbd_unbound_wq;
+ }
+ WRITE_ONCE(ksmbd_req_wq, wq);
+ return 0;
+}
+
int ksmbd_workqueue_init(void)
{
ksmbd_wq = alloc_workqueue("ksmbd-io", WQ_PERCPU, 0);
@@ -125,20 +179,26 @@ int ksmbd_workqueue_init(void)
ksmbd_wq = NULL;
return -ENOMEM;
}
+ WRITE_ONCE(ksmbd_req_wq, ksmbd_wq);
return 0;
}
void ksmbd_workqueue_destroy(void)
{
+ WRITE_ONCE(ksmbd_req_wq, NULL);
+ if (ksmbd_unbound_wq) {
+ destroy_workqueue(ksmbd_unbound_wq);
+ ksmbd_unbound_wq = NULL;
+ }
destroy_workqueue(ksmbd_wq);
ksmbd_wq = NULL;
destroy_workqueue(ksmbd_break_wq);
ksmbd_break_wq = NULL;
}
-bool ksmbd_queue_work(struct ksmbd_work *work)
+bool ksmbd_queue_request(struct ksmbd_work *work)
{
- return queue_work(ksmbd_wq, &work->work);
+ return queue_work(READ_ONCE(ksmbd_req_wq), &work->work);
}
void ksmbd_queue_io_work(struct work_struct *work)
diff --git a/fs/smb/server/ksmbd_work.h b/fs/smb/server/ksmbd_work.h
index 9fce93582eda..ef9fd66f3f7f 100644
--- a/fs/smb/server/ksmbd_work.h
+++ b/fs/smb/server/ksmbd_work.h
@@ -165,8 +165,9 @@ void ksmbd_work_pool_destroy(void);
int ksmbd_work_pool_init(void);
int ksmbd_workqueue_init(void);
+int ksmbd_prepare_request_wq(void);
void ksmbd_workqueue_destroy(void);
-bool ksmbd_queue_work(struct ksmbd_work *work);
+bool ksmbd_queue_request(struct ksmbd_work *work);
void ksmbd_queue_io_work(struct work_struct *work);
void ksmbd_queue_break_work(struct work_struct *work);
int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len,
diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
index af3d2a81157a..a376e2bed59b 100644
--- a/fs/smb/server/server.c
+++ b/fs/smb/server/server.c
@@ -539,7 +539,7 @@ static int queue_ksmbd_work(struct ksmbd_conn *conn)
/* update activity on connection */
conn->last_active = jiffies;
INIT_WORK(&work->work, handle_ksmbd_work);
- ksmbd_queue_work(work);
+ ksmbd_queue_request(work);
/* Negotiation can change conn->ops, finish it before reading another PDU. */
if (wait_for_neg)
wait_event(conn->req_running_q,
@@ -580,6 +580,7 @@ static void server_conf_free(void)
static int server_conf_init(void)
{
+ WRITE_ONCE(server_conf.request_wq_mode, KSMBD_WQ_PERCPU);
server_conf.enforced_signing = 0;
server_conf.min_protocol = ksmbd_min_protocol();
server_conf.max_protocol = ksmbd_max_protocol();
@@ -600,6 +601,12 @@ static int server_ctrl_handle_init(void)
{
int ret;
+ ret = ksmbd_prepare_request_wq();
+ if (ret) {
+ pr_err("Failed to configure request workqueue: %d\n", ret);
+ return ret;
+ }
+
ksmbd_proc_reset();
ret = ksmbd_conn_transport_init();
if (ret)
diff --git a/fs/smb/server/server.h b/fs/smb/server/server.h
index 28704174d8df..2a54102040f0 100644
--- a/fs/smb/server/server.h
+++ b/fs/smb/server/server.h
@@ -51,6 +51,7 @@ struct ksmbd_server_config {
char *conf[SERVER_CONF_WORK_GROUP + 1];
struct task_struct *dh_task;
bool bind_interfaces_only;
+ u8 request_wq_mode;
/* AAPL model string for Finder icon, e.g. "Xserve" */
char aapl_model[32];
};
diff --git a/fs/smb/server/transport_ipc.c b/fs/smb/server/transport_ipc.c
index 3c38d4a1e9cc..0539afddbd0b 100644
--- a/fs/smb/server/transport_ipc.c
+++ b/fs/smb/server/transport_ipc.c
@@ -318,6 +318,10 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req)
!memchr(req->server_string, '\0', sizeof(req->server_string)))
return -EINVAL;
+ if (req->request_wq_mode != KSMBD_WQ_PERCPU &&
+ req->request_wq_mode != KSMBD_WQ_UNBOUND)
+ return -EINVAL;
+
ksmbd_set_fd_limit(req->file_max);
server_conf.flags = req->flags;
server_conf.signing = req->signing;
@@ -392,6 +396,7 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req)
server_conf.max_protocol = ret;
}
+ WRITE_ONCE(server_conf.request_wq_mode, req->request_wq_mode);
if (server_conf.ipc_timeout)
schedule_delayed_work(&ipc_timer_work, server_conf.ipc_timeout);
return 0;
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-01 3:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/4] ksmbd: reset the server directly on startup failure Huiwen He
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox