@@ -235,6 +235,7 @@ enum KSMBD_TREE_CONN_STATUS {
#define KSMBD_SHARE_FLAG_STREAMS (1 << 11)
#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS (1 << 12)
#define KSMBD_SHARE_FLAG_ACL_XATTR (1 << 13)
+#define KSMBD_SHARE_FLAG_UPDATE (1 << 14)
/*
* Tree connect request flags.
@@ -250,6 +251,7 @@ enum KSMBD_TREE_CONN_STATUS {
#define KSMBD_TREE_CONN_FLAG_READ_ONLY (1 << 1)
#define KSMBD_TREE_CONN_FLAG_WRITABLE (1 << 2)
#define KSMBD_TREE_CONN_FLAG_ADMIN_ACCOUNT (1 << 3)
+#define KSMBD_TREE_CONN_FLAG_UPDATE (1 << 4)
/*
* RPC over IPC.
@@ -605,6 +605,9 @@ static void init_share_from_group(struct ksmbd_share *share,
if (!g_ascii_strcasecmp(share->name, "ipc$"))
set_share_flag(share, KSMBD_SHARE_FLAG_PIPE);
+ if (group->cb_mode == GROUPS_CALLBACK_REINIT)
+ set_share_flag(share, KSMBD_SHARE_FLAG_UPDATE);
+
g_hash_table_foreach(group->kv, process_group_kv, share);
fixup_missing_fields(share);
@@ -73,6 +73,8 @@ int tcm_handle_tree_connect(struct ksmbd_tree_connect_request *req,
set_conn_flag(conn, KSMBD_TREE_CONN_FLAG_WRITABLE);
if (test_share_flag(share, KSMBD_SHARE_FLAG_READONLY))
set_conn_flag(conn, KSMBD_TREE_CONN_FLAG_READ_ONLY);
+ if (test_share_flag(share, KSMBD_SHARE_FLAG_UPDATE))
+ set_conn_flag(conn, KSMBD_TREE_CONN_FLAG_UPDATE);
if (shm_open_connection(share)) {
resp->status = KSMBD_TREE_CONN_STATUS_TOO_MANY_CONNS;
@@ -207,8 +209,12 @@ bind:
tcm_tree_conn_free(conn);
put_ksmbd_user(user);
}
+
+ g_rw_lock_writer_lock(&share->update_lock);
+ clear_share_flag(share, KSMBD_SHARE_FLAG_UPDATE);
+ g_rw_lock_writer_unlock(&share->update_lock);
+
return 0;
-
out_error:
tcm_tree_conn_free(conn);
shm_close_connection(share);
When initializing a share from a group, flag the share with KSMBD_SHARE_FLAG_UPDATE if the group callback mode denotes that the config file was reloaded. If the share was flagged, then later when handling a tree connect request, flag the connection with KSMBD_TREE_CONN_FLAG_UPDATE to inform ksmbd that its cached share config is stale. If there are no failures when handling the request, remove the share flag. Signed-off-by: Atte Heikkilä <atteh.mailbox@gmail.com> --- include/linux/ksmbd_server.h | 2 ++ lib/management/share.c | 3 +++ lib/management/tree_conn.c | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-)