Skip to content

Commit cc44ce5

Browse files
committed
ksmbd-tools: add support for durable handles
As durable handles is supported in ksmbd kernel server, Add durable handles parameter in ksmbd-tools. I would like to make it default disable till it is stable. Signed-off-by: Namjae Jeon <[email protected]>
1 parent 92c757f commit cc44ce5

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

include/linux/ksmbd_server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct ksmbd_heartbeat {
2929
#define KSMBD_GLOBAL_FLAG_SMB3_ENCRYPTION (1 << 1)
3030
#define KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL (1 << 2)
3131
#define KSMBD_GLOBAL_FLAG_SMB3_ENCRYPTION_OFF (1 << 3)
32+
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLES (1 << 4)
3233

3334
struct ksmbd_startup_request {
3435
__u32 flags;

ksmbd.conf.5.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ Default: \fBdeadtime = 0\fR
7676
Octal bitmask that gets bitwise ANDed with DOS-to-UNIX-mapped permissions when creating a directory.
7777

7878
Default: \fBdirectory mask = 0755\fR
79+
.TP
80+
\fBdurable handles\fR (G)
81+
Can grant SMB2 durable file handles on a share.
82+
83+
Default: \fBdurable handles = no\fR
7984
\" .TP
8085
\" \fBfollow symlinks\fR (S)
8186
\"

ksmbd.conf.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
smbd max io size = 8MB
3232
tcp port = 445
3333
workgroup = WORKGROUP
34+
durable handles = no
3435

3536
; default share parameters
3637
browseable = yes

tools/config_parser.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,16 @@ static void process_global_conf_kv(char *k, char *v)
518518
KSMBD_CONF_MAX_CONNECTIONS;
519519
return;
520520
}
521+
522+
if (!cp_key_cmp(k, "durable handles")) {
523+
if (cp_get_group_kv_bool(v))
524+
global_conf.flags |=
525+
KSMBD_GLOBAL_FLAG_DURABLE_HANDLES;
526+
else
527+
global_conf.flags &=
528+
~KSMBD_GLOBAL_FLAG_DURABLE_HANDLES;
529+
return;
530+
}
521531
}
522532

523533
static void add_group_global_conf(void)

0 commit comments

Comments
 (0)