summaryrefslogtreecommitdiff
path: root/include/linux/mnt_namespace.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-07-19 13:41:50 +0200
committerChristian Brauner <brauner@kernel.org>2024-08-09 12:44:50 +0200
commit5fcf329676cf9d132842d9871f83a091c32f3bfc (patch)
treec234c72c7fb501a2cd36c873189c54b4faa9a3cf /include/linux/mnt_namespace.h
parent7b9d14af8777ac439bbfa9ac73a12a6d85289e7e (diff)
fs: add put_mnt_ns() cleanup helper
Add a simple helper to put a mount namespace reference. Link: https://lore.kernel.org/r/20240719-work-mount-namespace-v1-3-834113cab0d2@kernel.org Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux/mnt_namespace.h')
-rw-r--r--include/linux/mnt_namespace.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 8f882f5881e8..70b366b64816 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -3,6 +3,9 @@
#define _NAMESPACE_H_
#ifdef __KERNEL__
+#include <linux/cleanup.h>
+#include <linux/err.h>
+
struct mnt_namespace;
struct fs_struct;
struct user_namespace;
@@ -11,6 +14,7 @@ struct ns_common;
extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
struct user_namespace *, struct fs_struct *);
extern void put_mnt_ns(struct mnt_namespace *ns);
+DEFINE_FREE(put_mnt_ns, struct mnt_namespace *, if (!IS_ERR_OR_NULL(_T)) put_mnt_ns(_T))
extern struct ns_common *from_mnt_ns(struct mnt_namespace *);
extern const struct file_operations proc_mounts_operations;