linux/fs/smb/server/vfs_cache.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2016 Namjae Jeon <[email protected]>
 * Copyright (C) 2019 Samsung Electronics Co., Ltd.
 */

#include <linux/fs.h>
#include <linux/filelock.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/kthread.h>
#include <linux/freezer.h>

#include "glob.h"
#include "vfs_cache.h"
#include "oplock.h"
#include "vfs.h"
#include "connection.h"
#include "mgmt/tree_connect.h"
#include "mgmt/user_session.h"
#include "smb_common.h"
#include "server.h"

#define S_DEL_PENDING
#define S_DEL_ON_CLS
#define S_DEL_ON_CLS_STREAM

static unsigned int inode_hash_mask __read_mostly;
static unsigned int inode_hash_shift __read_mostly;
static struct hlist_head *inode_hashtable __read_mostly;
static DEFINE_RWLOCK(inode_hash_lock);

static struct ksmbd_file_table global_ft;
static atomic_long_t fd_limit;
static struct kmem_cache *filp_cache;

static bool durable_scavenger_running;
static DEFINE_MUTEX(durable_scavenger_lock);
static wait_queue_head_t dh_wq;

void ksmbd_set_fd_limit(unsigned long limit)
{}

static bool fd_limit_depleted(void)
{}

static void fd_limit_close(void)
{}

/*
 * INODE hash
 */

static unsigned long inode_hash(struct super_block *sb, unsigned long hashval)
{}

static struct ksmbd_inode *__ksmbd_inode_lookup(struct dentry *de)
{}

static struct ksmbd_inode *ksmbd_inode_lookup(struct ksmbd_file *fp)
{}

struct ksmbd_inode *ksmbd_inode_lookup_lock(struct dentry *d)
{}

int ksmbd_query_inode_status(struct dentry *dentry)
{}

bool ksmbd_inode_pending_delete(struct ksmbd_file *fp)
{}

void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp)
{}

void ksmbd_clear_inode_pending_delete(struct ksmbd_file *fp)
{}

void ksmbd_fd_set_delete_on_close(struct ksmbd_file *fp,
				  int file_info)
{}

static void ksmbd_inode_hash(struct ksmbd_inode *ci)
{}

static void ksmbd_inode_unhash(struct ksmbd_inode *ci)
{}

static int ksmbd_inode_init(struct ksmbd_inode *ci, struct ksmbd_file *fp)
{}

static struct ksmbd_inode *ksmbd_inode_get(struct ksmbd_file *fp)
{}

static void ksmbd_inode_free(struct ksmbd_inode *ci)
{}

void ksmbd_inode_put(struct ksmbd_inode *ci)
{}

int __init ksmbd_inode_hash_init(void)
{}

void ksmbd_release_inode_hash(void)
{}

static void __ksmbd_inode_close(struct ksmbd_file *fp)
{}

static void __ksmbd_remove_durable_fd(struct ksmbd_file *fp)
{}

static void ksmbd_remove_durable_fd(struct ksmbd_file *fp)
{}

static void __ksmbd_remove_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp)
{}

static void __ksmbd_close_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp)
{}

static struct ksmbd_file *ksmbd_fp_get(struct ksmbd_file *fp)
{}

static struct ksmbd_file *__ksmbd_lookup_fd(struct ksmbd_file_table *ft,
					    u64 id)
{}

static void __put_fd_final(struct ksmbd_work *work, struct ksmbd_file *fp)
{}

static void set_close_state_blocked_works(struct ksmbd_file *fp)
{}

int ksmbd_close_fd(struct ksmbd_work *work, u64 id)
{}

void ksmbd_fd_put(struct ksmbd_work *work, struct ksmbd_file *fp)
{}

static bool __sanity_check(struct ksmbd_tree_connect *tcon, struct ksmbd_file *fp)
{}

struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work, u64 id)
{}

struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work, u64 id)
{}

struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, u64 id,
					u64 pid)
{}

struct ksmbd_file *ksmbd_lookup_global_fd(unsigned long long id)
{}

struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id)
{}

void ksmbd_put_durable_fd(struct ksmbd_file *fp)
{}

struct ksmbd_file *ksmbd_lookup_fd_cguid(char *cguid)
{}

struct ksmbd_file *ksmbd_lookup_fd_inode(struct dentry *dentry)
{}

#define OPEN_ID_TYPE_VOLATILE_ID
#define OPEN_ID_TYPE_PERSISTENT_ID

static void __open_id_set(struct ksmbd_file *fp, u64 id, int type)
{}

static int __open_id(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
		     int type)
{}

unsigned int ksmbd_open_durable_fd(struct ksmbd_file *fp)
{}

struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work, struct file *filp)
{}

void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
			 unsigned int state)
{}

static int
__close_file_table_ids(struct ksmbd_file_table *ft,
		       struct ksmbd_tree_connect *tcon,
		       bool (*skip)(struct ksmbd_tree_connect *tcon,
				    struct ksmbd_file *fp))
{}

static inline bool is_reconnectable(struct ksmbd_file *fp)
{}

static bool tree_conn_fd_check(struct ksmbd_tree_connect *tcon,
			       struct ksmbd_file *fp)
{}

static bool ksmbd_durable_scavenger_alive(void)
{}

static void ksmbd_scavenger_dispose_dh(struct list_head *head)
{}

static int ksmbd_durable_scavenger(void *dummy)
{}

void ksmbd_launch_ksmbd_durable_scavenger(void)
{}

void ksmbd_stop_durable_scavenger(void)
{}

static bool session_fd_check(struct ksmbd_tree_connect *tcon,
			     struct ksmbd_file *fp)
{}

void ksmbd_close_tree_conn_fds(struct ksmbd_work *work)
{}

void ksmbd_close_session_fds(struct ksmbd_work *work)
{}

int ksmbd_init_global_file_table(void)
{}

void ksmbd_free_global_file_table(void)
{}

int ksmbd_validate_name_reconnect(struct ksmbd_share_config *share,
				  struct ksmbd_file *fp, char *name)
{}

int ksmbd_reopen_durable_fd(struct ksmbd_work *work, struct ksmbd_file *fp)
{}

int ksmbd_init_file_table(struct ksmbd_file_table *ft)
{}

void ksmbd_destroy_file_table(struct ksmbd_file_table *ft)
{}

int ksmbd_init_file_cache(void)
{}

void ksmbd_exit_file_cache(void)
{}