xref: /freebsd/sys/contrib/openzfs/include/os/linux/kernel/linux/kthread_compat.h (revision 2f10ffc003be396f3fc23cd2888023896560252b)
1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3  * This file and its contents are supplied under the terms of the
4  * Common Development and Distribution License ("CDDL"), version 1.0.
5  * You may only use this file in accordance with the terms of version
6  * 1.0 of the CDDL.
7  *
8  * A full copy of the text of the CDDL should have accompanied this
9  * source.  A copy of the CDDL is also available via the Internet at
10  * https://opensource.org/license/CDDL-1.0.
11  */
12 
13 /*
14  * Copyright (c) 2026, TrueNAS.
15  */
16 
17 #ifndef _ZFS_KTHREAD_COMPAT_H
18 #define	_ZFS_KTHREAD_COMPAT_H
19 
20 #include <linux/fs_struct.h>
21 
22 /*
23  * Linux 7.3 change. Kernel-internal threads no longer have access to the
24  * filesystem by default. Callers that need it should wrap the necessary code
25  * in `scoped_with_init_fs()`, which will make the filesystem availble until
26  * end of scope.
27  *
28  * For older kernels that do not provide this macro, we define it to be a
29  * no-op.
30  */
31 #ifndef scoped_with_init_fs
32 #define	scoped_with_init_fs()	if (1)
33 #endif
34 
35 #endif
36