diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-09 00:59:08 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:32:47 -0400 |
commit | f7a99c5b7c8bd3d3f533c8b38274e33f3da9096e (patch) | |
tree | 5c326c0ddd1f40eacbe2fd7c888f26b089389f99 /fs/fs_struct.c | |
parent | d187663ef24cd3d033f0cbf2867e70b36a3a90b8 (diff) |
get rid of ->mnt_longterm
it's enough to set ->mnt_ns of internal vfsmounts to something
distinct from all struct mnt_namespace out there; then we can
just use the check for ->mnt_ns != NULL in the fast path of
mntput_no_expire()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fs_struct.c')
-rw-r--r-- | fs/fs_struct.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/fs/fs_struct.c b/fs/fs_struct.c index e159e682ad4c..5df4775fea03 100644 --- a/fs/fs_struct.c +++ b/fs/fs_struct.c | |||
@@ -6,18 +6,6 @@ | |||
6 | #include <linux/fs_struct.h> | 6 | #include <linux/fs_struct.h> |
7 | #include "internal.h" | 7 | #include "internal.h" |
8 | 8 | ||
9 | static inline void path_get_longterm(struct path *path) | ||
10 | { | ||
11 | path_get(path); | ||
12 | mnt_make_longterm(path->mnt); | ||
13 | } | ||
14 | |||
15 | static inline void path_put_longterm(struct path *path) | ||
16 | { | ||
17 | mnt_make_shortterm(path->mnt); | ||
18 | path_put(path); | ||
19 | } | ||
20 | |||
21 | /* | 9 | /* |
22 | * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. | 10 | * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. |
23 | * It can block. | 11 | * It can block. |
@@ -26,7 +14,7 @@ void set_fs_root(struct fs_struct *fs, struct path *path) | |||
26 | { | 14 | { |
27 | struct path old_root; | 15 | struct path old_root; |
28 | 16 | ||
29 | path_get_longterm(path); | 17 | path_get(path); |
30 | spin_lock(&fs->lock); | 18 | spin_lock(&fs->lock); |
31 | write_seqcount_begin(&fs->seq); | 19 | write_seqcount_begin(&fs->seq); |
32 | old_root = fs->root; | 20 | old_root = fs->root; |
@@ -34,7 +22,7 @@ void set_fs_root(struct fs_struct *fs, struct path *path) | |||
34 | write_seqcount_end(&fs->seq); | 22 | write_seqcount_end(&fs->seq); |
35 | spin_unlock(&fs->lock); | 23 | spin_unlock(&fs->lock); |
36 | if (old_root.dentry) | 24 | if (old_root.dentry) |
37 | path_put_longterm(&old_root); | 25 | path_put(&old_root); |
38 | } | 26 | } |
39 | 27 | ||
40 | /* | 28 | /* |
@@ -45,7 +33,7 @@ void set_fs_pwd(struct fs_struct *fs, struct path *path) | |||
45 | { | 33 | { |
46 | struct path old_pwd; | 34 | struct path old_pwd; |
47 | 35 | ||
48 | path_get_longterm(path); | 36 | path_get(path); |
49 | spin_lock(&fs->lock); | 37 | spin_lock(&fs->lock); |
50 | write_seqcount_begin(&fs->seq); | 38 | write_seqcount_begin(&fs->seq); |
51 | old_pwd = fs->pwd; | 39 | old_pwd = fs->pwd; |
@@ -54,7 +42,7 @@ void set_fs_pwd(struct fs_struct *fs, struct path *path) | |||
54 | spin_unlock(&fs->lock); | 42 | spin_unlock(&fs->lock); |
55 | 43 | ||
56 | if (old_pwd.dentry) | 44 | if (old_pwd.dentry) |
57 | path_put_longterm(&old_pwd); | 45 | path_put(&old_pwd); |
58 | } | 46 | } |
59 | 47 | ||
60 | static inline int replace_path(struct path *p, const struct path *old, const struct path *new) | 48 | static inline int replace_path(struct path *p, const struct path *old, const struct path *new) |
@@ -84,7 +72,7 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root) | |||
84 | write_seqcount_end(&fs->seq); | 72 | write_seqcount_end(&fs->seq); |
85 | while (hits--) { | 73 | while (hits--) { |
86 | count++; | 74 | count++; |
87 | path_get_longterm(new_root); | 75 | path_get(new_root); |
88 | } | 76 | } |
89 | spin_unlock(&fs->lock); | 77 | spin_unlock(&fs->lock); |
90 | } | 78 | } |
@@ -92,13 +80,13 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root) | |||
92 | } while_each_thread(g, p); | 80 | } while_each_thread(g, p); |
93 | read_unlock(&tasklist_lock); | 81 | read_unlock(&tasklist_lock); |
94 | while (count--) | 82 | while (count--) |
95 | path_put_longterm(old_root); | 83 | path_put(old_root); |
96 | } | 84 | } |
97 | 85 | ||
98 | void free_fs_struct(struct fs_struct *fs) | 86 | void free_fs_struct(struct fs_struct *fs) |
99 | { | 87 | { |
100 | path_put_longterm(&fs->root); | 88 | path_put(&fs->root); |
101 | path_put_longterm(&fs->pwd); | 89 | path_put(&fs->pwd); |
102 | kmem_cache_free(fs_cachep, fs); | 90 | kmem_cache_free(fs_cachep, fs); |
103 | } | 91 | } |
104 | 92 | ||
@@ -132,9 +120,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) | |||
132 | 120 | ||
133 | spin_lock(&old->lock); | 121 | spin_lock(&old->lock); |
134 | fs->root = old->root; | 122 | fs->root = old->root; |
135 | path_get_longterm(&fs->root); | 123 | path_get(&fs->root); |
136 | fs->pwd = old->pwd; | 124 | fs->pwd = old->pwd; |
137 | path_get_longterm(&fs->pwd); | 125 | path_get(&fs->pwd); |
138 | spin_unlock(&old->lock); | 126 | spin_unlock(&old->lock); |
139 | } | 127 | } |
140 | return fs; | 128 | return fs; |