mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
8b758859df
Reorder and document on-disk and netlink structures in headers. This is a userspace ABI to communicate data between ksmbd and user IPC daemon using netlink. This is added to track and cache user account DB and share configuration info from userspace. - KSMBD_EVENT_HEARTBEAT_REQUEST(ksmbd_heartbeat) This event is to check whether user IPC daemon is alive. If user IPC daemon is dead, ksmbd keep existing connection till disconnecting and new connection will be denied. - KSMBD_EVENT_STARTING_UP(ksmbd_startup_request) This event is to receive the information that initializes the ksmbd server from the user IPC daemon and to start the server. The global section parameters are given from smb.conf as initialization information. - KSMBD_EVENT_SHUTTING_DOWN(ksmbd_shutdown_request) This event is to shutdown ksmbd server. - KSMBD_EVENT_LOGIN_REQUEST/RESPONSE(ksmbd_login_request/response) This event is to get user account info to user IPC daemon. - KSMBD_EVENT_SHARE_CONFIG_REQUEST/RESPONSE (ksmbd_share_config_request/response) This event is to get net share configuration info. - KSMBD_EVENT_TREE_CONNECT_REQUEST/RESPONSE (ksmbd_tree_connect_request/response) This event is to get session and tree connect info. - KSMBD_EVENT_TREE_DISCONNECT_REQUEST(ksmbd_tree_disconnect_request) This event is to send tree disconnect info to user IPC daemon. - KSMBD_EVENT_LOGOUT_REQUEST(ksmbd_logout_request) This event is to send logout request to user IPC daemon. - KSMBD_EVENT_RPC_REQUEST/RESPONSE(ksmbd_rpc_command) This event is to make DCE/RPC request like srvsvc, wkssvc, lsarpc, samr to be processed in userspace. - KSMBD_EVENT_SPNEGO_AUTHEN_REQUEST/RESPONSE (ksmbd_spnego_authen_request/response) This event is to make kerberos authentication to be processed in userspace. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
81 lines
1.7 KiB
C
81 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2019 Samsung Electronics Co., Ltd.
|
|
*/
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include "server.h"
|
|
#include "connection.h"
|
|
#include "ksmbd_work.h"
|
|
#include "mgmt/ksmbd_ida.h"
|
|
|
|
static struct kmem_cache *work_cache;
|
|
static struct workqueue_struct *ksmbd_wq;
|
|
|
|
struct ksmbd_work *ksmbd_alloc_work_struct(void)
|
|
{
|
|
struct ksmbd_work *work = kmem_cache_zalloc(work_cache, GFP_KERNEL);
|
|
|
|
if (work) {
|
|
work->compound_fid = KSMBD_NO_FID;
|
|
work->compound_pfid = KSMBD_NO_FID;
|
|
INIT_LIST_HEAD(&work->request_entry);
|
|
INIT_LIST_HEAD(&work->async_request_entry);
|
|
INIT_LIST_HEAD(&work->fp_entry);
|
|
INIT_LIST_HEAD(&work->interim_entry);
|
|
}
|
|
return work;
|
|
}
|
|
|
|
void ksmbd_free_work_struct(struct ksmbd_work *work)
|
|
{
|
|
WARN_ON(work->saved_cred != NULL);
|
|
|
|
kvfree(work->response_buf);
|
|
kvfree(work->aux_payload_buf);
|
|
kfree(work->tr_buf);
|
|
kvfree(work->request_buf);
|
|
if (work->async_id)
|
|
ksmbd_release_id(&work->conn->async_ida, work->async_id);
|
|
kmem_cache_free(work_cache, work);
|
|
}
|
|
|
|
void ksmbd_work_pool_destroy(void)
|
|
{
|
|
kmem_cache_destroy(work_cache);
|
|
}
|
|
|
|
int ksmbd_work_pool_init(void)
|
|
{
|
|
work_cache = kmem_cache_create("ksmbd_work_cache",
|
|
sizeof(struct ksmbd_work), 0,
|
|
SLAB_HWCACHE_ALIGN, NULL);
|
|
if (!work_cache)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
|
|
int ksmbd_workqueue_init(void)
|
|
{
|
|
ksmbd_wq = alloc_workqueue("ksmbd-io", 0, 0);
|
|
if (!ksmbd_wq)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
|
|
void ksmbd_workqueue_destroy(void)
|
|
{
|
|
flush_workqueue(ksmbd_wq);
|
|
destroy_workqueue(ksmbd_wq);
|
|
ksmbd_wq = NULL;
|
|
}
|
|
|
|
bool ksmbd_queue_work(struct ksmbd_work *work)
|
|
{
|
|
return queue_work(ksmbd_wq, &work->work);
|
|
}
|