xref: /kernel/linux/linux-6.6/fs/sharefs/dentry.c (revision 62306a36)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * fs/sharefs/dentry.c
4 *
5 * Copyright (c) 1998-2022 Erez Zadok
6 * Copyright (c) 2009	   Shrikar Archak
7 * Copyright (c) 2003-2022 Stony Brook University
8 * Copyright (c) 2003-2022 The Research Foundation of SUNY
9 * Copyright (c) 2023 Huawei Device Co., Ltd.
10 */
11
12#include "sharefs.h"
13
14/*
15 * returns: 0: tell VFS to invalidate dentry in share directory
16 */
17static int sharefs_d_revalidate(struct dentry *dentry, unsigned int flags)
18{
19	return 0;
20}
21
22static void sharefs_d_release(struct dentry *dentry)
23{
24	/*
25	 * It is possible that the dentry private data is NULL in case we
26	 * ran out of memory while initializing it in
27	 * new_dentry_private_data.  So check for NULL before attempting to
28	 * release resources.
29	 */
30	if (SHAREFS_D(dentry)) {
31		/* release and reset the lower paths */
32		sharefs_put_reset_lower_path(dentry);
33		free_dentry_private_data(dentry);
34	}
35	return;
36}
37
38const struct dentry_operations sharefs_dops = {
39	.d_revalidate	= sharefs_d_revalidate,
40	.d_release	= sharefs_d_release,
41};
42