Skip to content

Commit 5fcf329

Browse files
committed
fs: add put_mnt_ns() cleanup helper
Add a simple helper to put a mount namespace reference. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Josef Bacik <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 7b9d14a commit 5fcf329

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/linux/mnt_namespace.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#define _NAMESPACE_H_
44
#ifdef __KERNEL__
55

6+
#include <linux/cleanup.h>
7+
#include <linux/err.h>
8+
69
struct mnt_namespace;
710
struct fs_struct;
811
struct user_namespace;
@@ -11,6 +14,7 @@ struct ns_common;
1114
extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
1215
struct user_namespace *, struct fs_struct *);
1316
extern void put_mnt_ns(struct mnt_namespace *ns);
17+
DEFINE_FREE(put_mnt_ns, struct mnt_namespace *, if (!IS_ERR_OR_NULL(_T)) put_mnt_ns(_T))
1418
extern struct ns_common *from_mnt_ns(struct mnt_namespace *);
1519

1620
extern const struct file_operations proc_mounts_operations;

0 commit comments

Comments
 (0)