From f47ec3f28354795f000c14bf18ed967ec81a3ec3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 21 Nov 2011 21:15:42 -0500 Subject: trim fs/internal.h some stuff in there can actually become static; some belongs to pnode.h as it's a private interface between namespace.c and pnode.c... Signed-off-by: Al Viro --- fs/pnode.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 1ea4ae1efcd..39128711027 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -36,4 +36,10 @@ int propagate_umount(struct list_head *); int propagate_mount_busy(struct vfsmount *, int); void mnt_release_group_id(struct vfsmount *); int get_dominating_id(struct vfsmount *mnt, const struct path *root); +unsigned int mnt_get_count(struct vfsmount *mnt); +void mnt_set_mountpoint(struct vfsmount *, struct dentry *, + struct vfsmount *); +void release_mounts(struct list_head *); +void umount_tree(struct vfsmount *, int, struct list_head *); +struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); #endif /* _LINUX_PNODE_H */ -- cgit v1.2.3 From b2dba1af3c4157040303a76d25216b1713d333d0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 23 Nov 2011 19:26:23 -0500 Subject: vfs: new internal helper: mnt_has_parent(mnt) vfsmounts have ->mnt_parent pointing either to a different vfsmount or to itself; it's never NULL and termination condition in loops traversing the tree towards root is mnt == mnt->mnt_parent. At least one place (see the next patch) is confused about what's going on; let's add an explicit helper checking it right way and use it in all places where we need it. Not that there had been too many, but... Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 39128711027..7f0c13ae948 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -9,7 +9,7 @@ #define _LINUX_PNODE_H #include -#include +#include "mount.h" #define IS_MNT_SHARED(mnt) (mnt->mnt_flags & MNT_SHARED) #define IS_MNT_SLAVE(mnt) (mnt->mnt_master) -- cgit v1.2.3 From afac7cba7ed31968a95e181dc25e204e45009ea8 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 23 Nov 2011 19:34:49 -0500 Subject: vfs: more mnt_parent cleanups a) mount --move is checking that ->mnt_parent is non-NULL before looking if that parent happens to be shared; ->mnt_parent is never NULL and it's not even an misspelled !mnt_has_parent() b) pivot_root open-codes is_path_reachable(), poorly. c) so does path_is_under(), while we are at it. Signed-off-by: Al Viro --- fs/pnode.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 7f0c13ae948..723399e7613 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -42,4 +42,6 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *, void release_mounts(struct list_head *); void umount_tree(struct vfsmount *, int, struct list_head *); struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); +bool is_path_reachable(struct vfsmount *, struct dentry *, + const struct path *root); #endif /* _LINUX_PNODE_H */ -- cgit v1.2.3 From aafd08dad019ecc858b31fb89064f4de623c64f7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 23 Nov 2011 12:27:01 -0500 Subject: vfs: add missing parens in pnode.h macros Signed-off-by: Al Viro --- fs/pnode.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 723399e7613..5c234e74219 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -11,11 +11,11 @@ #include #include "mount.h" -#define IS_MNT_SHARED(mnt) (mnt->mnt_flags & MNT_SHARED) -#define IS_MNT_SLAVE(mnt) (mnt->mnt_master) -#define IS_MNT_NEW(mnt) (!mnt->mnt_ns) -#define CLEAR_MNT_SHARED(mnt) (mnt->mnt_flags &= ~MNT_SHARED) -#define IS_MNT_UNBINDABLE(mnt) (mnt->mnt_flags & MNT_UNBINDABLE) +#define IS_MNT_SHARED(mnt) ((mnt)->mnt_flags & MNT_SHARED) +#define IS_MNT_SLAVE(mnt) ((mnt)->mnt_master) +#define IS_MNT_NEW(mnt) (!(mnt)->mnt_ns) +#define CLEAR_MNT_SHARED(mnt) ((mnt)->mnt_flags &= ~MNT_SHARED) +#define IS_MNT_UNBINDABLE(mnt) ((mnt)->mnt_flags & MNT_UNBINDABLE) #define CL_EXPIRE 0x01 #define CL_SLAVE 0x02 -- cgit v1.2.3 From 4b8b21f4fe16ee15eec5c69ea5fb41b30e428e59 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 19:54:23 -0500 Subject: vfs: spread struct mount - mount group id handling Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 5c234e74219..23dfe22139d 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -34,7 +34,7 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, struct list_head *); int propagate_umount(struct list_head *); int propagate_mount_busy(struct vfsmount *, int); -void mnt_release_group_id(struct vfsmount *); +void mnt_release_group_id(struct mount *); int get_dominating_id(struct vfsmount *mnt, const struct path *root); unsigned int mnt_get_count(struct vfsmount *mnt); void mnt_set_mountpoint(struct vfsmount *, struct dentry *, -- cgit v1.2.3 From 0f0afb1dcf01afc44581b3c0da251ac07dfb6e4a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 20:43:10 -0500 Subject: vfs: spread struct mount - change_mnt_propagation/set_mnt_shared Signed-off-by: Al Viro --- fs/pnode.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 23dfe22139d..a2ad95435c4 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -23,13 +23,13 @@ #define CL_MAKE_SHARED 0x08 #define CL_PRIVATE 0x10 -static inline void set_mnt_shared(struct vfsmount *mnt) +static inline void set_mnt_shared(struct mount *mnt) { - mnt->mnt_flags &= ~MNT_SHARED_MASK; - mnt->mnt_flags |= MNT_SHARED; + mnt->mnt.mnt_flags &= ~MNT_SHARED_MASK; + mnt->mnt.mnt_flags |= MNT_SHARED; } -void change_mnt_propagation(struct vfsmount *, int); +void change_mnt_propagation(struct mount *, int); int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, struct list_head *); int propagate_umount(struct list_head *); -- cgit v1.2.3 From cb338d06e9716c92d5a7855e7c67b8f111ced722 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 20:55:08 -0500 Subject: vfs: spread struct mount - clone_mnt/copy_tree result Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index a2ad95435c4..ed8a84d6d78 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -41,7 +41,7 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *, struct vfsmount *); void release_mounts(struct list_head *); void umount_tree(struct vfsmount *, int, struct list_head *); -struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); +struct mount *copy_tree(struct vfsmount *, struct dentry *, int); bool is_path_reachable(struct vfsmount *, struct dentry *, const struct path *root); #endif /* _LINUX_PNODE_H */ -- cgit v1.2.3 From 761d5c38eb3d8e2aa7394726dccab245bfe2f41c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 21:07:43 -0500 Subject: vfs: spread struct mount - umount_tree argument Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index ed8a84d6d78..3f9ab4f4e0e 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -40,7 +40,7 @@ unsigned int mnt_get_count(struct vfsmount *mnt); void mnt_set_mountpoint(struct vfsmount *, struct dentry *, struct vfsmount *); void release_mounts(struct list_head *); -void umount_tree(struct vfsmount *, int, struct list_head *); +void umount_tree(struct mount *, int, struct list_head *); struct mount *copy_tree(struct vfsmount *, struct dentry *, int); bool is_path_reachable(struct vfsmount *, struct dentry *, const struct path *root); -- cgit v1.2.3 From 87129cc0e3fcd89a1db3e99d62dc710e05749f77 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 21:24:27 -0500 Subject: vfs: spread struct mount - clone_mnt/copy_tree argument Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 3f9ab4f4e0e..609ec008d5c 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -41,7 +41,7 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *, struct vfsmount *); void release_mounts(struct list_head *); void umount_tree(struct mount *, int, struct list_head *); -struct mount *copy_tree(struct vfsmount *, struct dentry *, int); +struct mount *copy_tree(struct mount *, struct dentry *, int); bool is_path_reachable(struct vfsmount *, struct dentry *, const struct path *root); #endif /* _LINUX_PNODE_H */ -- cgit v1.2.3 From 44d964d609c7c11b330a3d1caf30767fa13c7be3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 21:28:22 -0500 Subject: vfs: spread struct mount mnt_set_mountpoint child argument Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 609ec008d5c..bfd0bbcabf6 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -38,7 +38,7 @@ void mnt_release_group_id(struct mount *); int get_dominating_id(struct vfsmount *mnt, const struct path *root); unsigned int mnt_get_count(struct vfsmount *mnt); void mnt_set_mountpoint(struct vfsmount *, struct dentry *, - struct vfsmount *); + struct mount *); void release_mounts(struct list_head *); void umount_tree(struct mount *, int, struct list_head *); struct mount *copy_tree(struct mount *, struct dentry *, int); -- cgit v1.2.3 From 1ab597386205f8dc757cf8750465502aeae65154 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 21:35:16 -0500 Subject: vfs: spread struct mount - do_umount/propagate_mount_busy Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index bfd0bbcabf6..f1d251d3771 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -33,7 +33,7 @@ void change_mnt_propagation(struct mount *, int); int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, struct list_head *); int propagate_umount(struct list_head *); -int propagate_mount_busy(struct vfsmount *, int); +int propagate_mount_busy(struct mount *, int); void mnt_release_group_id(struct mount *); int get_dominating_id(struct vfsmount *mnt, const struct path *root); unsigned int mnt_get_count(struct vfsmount *mnt); -- cgit v1.2.3 From 643822b41e5e0f133438883b0be574cdaf168a2a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 22:00:28 -0500 Subject: vfs: spread struct mount - is_path_reachable Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index f1d251d3771..866b3e29288 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -42,6 +42,6 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *, void release_mounts(struct list_head *); void umount_tree(struct mount *, int, struct list_head *); struct mount *copy_tree(struct mount *, struct dentry *, int); -bool is_path_reachable(struct vfsmount *, struct dentry *, +bool is_path_reachable(struct mount *, struct dentry *, const struct path *root); #endif /* _LINUX_PNODE_H */ -- cgit v1.2.3 From 83adc7532229f1909cf37c429780f02f06fe05ee Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 22:37:54 -0500 Subject: vfs: spread struct mount - work with counters Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 866b3e29288..0a7a919d5ef 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -36,7 +36,7 @@ int propagate_umount(struct list_head *); int propagate_mount_busy(struct mount *, int); void mnt_release_group_id(struct mount *); int get_dominating_id(struct vfsmount *mnt, const struct path *root); -unsigned int mnt_get_count(struct vfsmount *mnt); +unsigned int mnt_get_count(struct mount *mnt); void mnt_set_mountpoint(struct vfsmount *, struct dentry *, struct mount *); void release_mounts(struct list_head *); -- cgit v1.2.3 From 6fc7871fed915914ef441efbe0f9a7c3d0f3bff1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 23:35:54 -0500 Subject: vfs: spread struct mount - get_dominating_id / do_make_slave next pile of horrors, similar to mnt_parent one; this time it's mnt_master. Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 0a7a919d5ef..33f1e3cb3cd 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -35,7 +35,7 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, int propagate_umount(struct list_head *); int propagate_mount_busy(struct mount *, int); void mnt_release_group_id(struct mount *); -int get_dominating_id(struct vfsmount *mnt, const struct path *root); +int get_dominating_id(struct mount *mnt, const struct path *root); unsigned int mnt_get_count(struct mount *mnt); void mnt_set_mountpoint(struct vfsmount *, struct dentry *, struct mount *); -- cgit v1.2.3 From a8d56d8e4fa0cb9a023834363f8d79415d277a1d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Nov 2011 23:59:29 -0500 Subject: vfs: spread struct mount - propagate_mnt() Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 33f1e3cb3cd..55546a2f9b5 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -30,7 +30,7 @@ static inline void set_mnt_shared(struct mount *mnt) } void change_mnt_propagation(struct mount *, int); -int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, +int propagate_mnt(struct mount *, struct dentry *, struct mount *, struct list_head *); int propagate_umount(struct list_head *); int propagate_mount_busy(struct mount *, int); -- cgit v1.2.3 From 14cf1fa8f54353d9caf6174c1e4280c8c4dcfd7a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 25 Nov 2011 00:01:17 -0500 Subject: vfs: spread struct mount - remaining argument of mnt_set_mountpoint() Signed-off-by: Al Viro --- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 55546a2f9b5..54deeda0cdb 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -37,7 +37,7 @@ int propagate_mount_busy(struct mount *, int); void mnt_release_group_id(struct mount *); int get_dominating_id(struct mount *mnt, const struct path *root); unsigned int mnt_get_count(struct mount *mnt); -void mnt_set_mountpoint(struct vfsmount *, struct dentry *, +void mnt_set_mountpoint(struct mount *, struct dentry *, struct mount *); void release_mounts(struct list_head *); void umount_tree(struct mount *, int, struct list_head *); -- cgit v1.2.3 From fc7be130c7e91cf693d4bc2d9b11f08a5a4893d0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 25 Nov 2011 01:05:37 -0500 Subject: vfs: switch pnode.h macros to struct mount * Signed-off-by: Al Viro --- fs/pnode.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fs/pnode.h') diff --git a/fs/pnode.h b/fs/pnode.h index 54deeda0cdb..65c60979d54 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -11,11 +11,11 @@ #include #include "mount.h" -#define IS_MNT_SHARED(mnt) ((mnt)->mnt_flags & MNT_SHARED) -#define IS_MNT_SLAVE(mnt) ((mnt)->mnt_master) -#define IS_MNT_NEW(mnt) (!(mnt)->mnt_ns) -#define CLEAR_MNT_SHARED(mnt) ((mnt)->mnt_flags &= ~MNT_SHARED) -#define IS_MNT_UNBINDABLE(mnt) ((mnt)->mnt_flags & MNT_UNBINDABLE) +#define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED) +#define IS_MNT_SLAVE(m) ((m)->mnt_master) +#define IS_MNT_NEW(m) (!(m)->mnt_ns) +#define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED) +#define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE) #define CL_EXPIRE 0x01 #define CL_SLAVE 0x02 -- cgit v1.2.3