Skip to content

Commit

Permalink
ksmbd-tools: add support for durable handles
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
namjaejeon committed Mar 27, 2024
1 parent 92c757f commit cc44ce5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/ksmbd_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct ksmbd_heartbeat {
#define KSMBD_GLOBAL_FLAG_SMB3_ENCRYPTION (1 << 1)
#define KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL (1 << 2)
#define KSMBD_GLOBAL_FLAG_SMB3_ENCRYPTION_OFF (1 << 3)
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLES (1 << 4)

struct ksmbd_startup_request {
__u32 flags;
Expand Down
5 changes: 5 additions & 0 deletions ksmbd.conf.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ Default: \fBdeadtime = 0\fR
Octal bitmask that gets bitwise ANDed with DOS-to-UNIX-mapped permissions when creating a directory.

Default: \fBdirectory mask = 0755\fR
.TP
\fBdurable handles\fR (G)
Can grant SMB2 durable file handles on a share.

Default: \fBdurable handles = no\fR
\" .TP
\" \fBfollow symlinks\fR (S)
\"
Expand Down
1 change: 1 addition & 0 deletions ksmbd.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
smbd max io size = 8MB
tcp port = 445
workgroup = WORKGROUP
durable handles = no

; default share parameters
browseable = yes
Expand Down
10 changes: 10 additions & 0 deletions tools/config_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,16 @@ static void process_global_conf_kv(char *k, char *v)
KSMBD_CONF_MAX_CONNECTIONS;
return;
}

if (!cp_key_cmp(k, "durable handles")) {
if (cp_get_group_kv_bool(v))
global_conf.flags |=
KSMBD_GLOBAL_FLAG_DURABLE_HANDLES;
else
global_conf.flags &=
~KSMBD_GLOBAL_FLAG_DURABLE_HANDLES;
return;
}
}

static void add_group_global_conf(void)
Expand Down

0 comments on commit cc44ce5

Please sign in to comment.