[PATCH 1/4] ksmbd: advertise SMB2_GLOBAL_CAP_PERSISTENT_HANDLES
Yunseong Kim <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel,org.kernel.vger.linux-cifs |
|---|---|
| Message-ID | <[email protected]> |
Advertise SMB2_GLOBAL_CAP_PERSISTENT_HANDLES in the SMB2 negotiate response when durable handles are enabled globally. This tells clients that the server supports persistent handles, which is a prerequisite for Continuously Available (CA) share functionality. The capability is gated by KSMBD_GLOBAL_FLAG_DURABLE_HANDLE (controlled by 'durable handles = yes' in ksmbd.conf) so administrators must explicitly enable it. Signed-off-by: Yunseong Kim <[email protected]> --- fs/smb/server/smb2ops.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/smb/server/smb2ops.c b/fs/smb/server/smb2ops.c index 4578291fb172..414153fa2a68 100644 --- a/fs/smb/server/smb2ops.c +++ b/fs/smb/server/smb2ops.c @@ -270,10 +270,8 @@ void init_smb3_02_server(struct ksmbd_conn *conn) if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL) conn->vals->req_capabilities |= SMB2_GLOBAL_CAP_MULTI_CHANNEL; - /* - * Durable handles are in-memory only. Do not advertise persistent - * handles until CA recovery and fencing are implemented. - */ + if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE) + conn->vals->req_capabilities |= SMB2_GLOBAL_CAP_PERSISTENT_HANDLES; } /** @@ -296,7 +294,9 @@ int init_smb3_11_server(struct ksmbd_conn *conn) if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL) conn->vals->req_capabilities |= SMB2_GLOBAL_CAP_MULTI_CHANNEL; - /* See init_smb3_02_server(): persistent handles require CA recovery. */ + if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE) + conn->vals->req_capabilities |= SMB2_GLOBAL_CAP_PERSISTENT_HANDLES; + return 0; } -- 2.47.3