diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-16 16:32:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-16 17:59:45 -0500 |
commit | 7e3d0eb0b028ed9e9384e6afcae2f22993bbdf25 (patch) | |
tree | 37bbffdfc6d380d04c294fa43d75697694f44d4d | |
parent | f8b18087fd3277e424a24e13ce0edf30abe97ce0 (diff) |
VFS: Fix UP compile error in fs/namespace.c
mnt_longterm is there only on SMP
Reported-and-tested-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/namespace.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 48809e21f270..9f544f35ed34 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -611,6 +611,21 @@ static void attach_mnt(struct vfsmount *mnt, struct path *path) | |||
611 | list_add_tail(&mnt->mnt_child, &path->mnt->mnt_mounts); | 611 | list_add_tail(&mnt->mnt_child, &path->mnt->mnt_mounts); |
612 | } | 612 | } |
613 | 613 | ||
614 | static inline void __mnt_make_longterm(struct vfsmount *mnt) | ||
615 | { | ||
616 | #ifdef CONFIG_SMP | ||
617 | atomic_inc(&mnt->mnt_longterm); | ||
618 | #endif | ||
619 | } | ||
620 | |||
621 | /* needs vfsmount lock for write */ | ||
622 | static inline void __mnt_make_shortterm(struct vfsmount *mnt) | ||
623 | { | ||
624 | #ifdef CONFIG_SMP | ||
625 | atomic_dec(&mnt->mnt_longterm); | ||
626 | #endif | ||
627 | } | ||
628 | |||
614 | /* | 629 | /* |
615 | * vfsmount lock must be held for write | 630 | * vfsmount lock must be held for write |
616 | */ | 631 | */ |
@@ -626,7 +641,7 @@ static void commit_tree(struct vfsmount *mnt) | |||
626 | list_add_tail(&head, &mnt->mnt_list); | 641 | list_add_tail(&head, &mnt->mnt_list); |
627 | list_for_each_entry(m, &head, mnt_list) { | 642 | list_for_each_entry(m, &head, mnt_list) { |
628 | m->mnt_ns = n; | 643 | m->mnt_ns = n; |
629 | atomic_inc(&m->mnt_longterm); | 644 | __mnt_make_longterm(m); |
630 | } | 645 | } |
631 | 646 | ||
632 | list_splice(&head, n->list.prev); | 647 | list_splice(&head, n->list.prev); |
@@ -1189,7 +1204,7 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) | |||
1189 | list_del_init(&p->mnt_list); | 1204 | list_del_init(&p->mnt_list); |
1190 | __touch_mnt_namespace(p->mnt_ns); | 1205 | __touch_mnt_namespace(p->mnt_ns); |
1191 | p->mnt_ns = NULL; | 1206 | p->mnt_ns = NULL; |
1192 | atomic_dec(&p->mnt_longterm); | 1207 | __mnt_make_shortterm(p); |
1193 | list_del_init(&p->mnt_child); | 1208 | list_del_init(&p->mnt_child); |
1194 | if (p->mnt_parent != p) { | 1209 | if (p->mnt_parent != p) { |
1195 | p->mnt_parent->mnt_ghosts++; | 1210 | p->mnt_parent->mnt_ghosts++; |
@@ -2243,16 +2258,18 @@ static struct mnt_namespace *alloc_mnt_ns(void) | |||
2243 | 2258 | ||
2244 | void mnt_make_longterm(struct vfsmount *mnt) | 2259 | void mnt_make_longterm(struct vfsmount *mnt) |
2245 | { | 2260 | { |
2246 | atomic_inc(&mnt->mnt_longterm); | 2261 | __mnt_make_longterm(mnt); |
2247 | } | 2262 | } |
2248 | 2263 | ||
2249 | void mnt_make_shortterm(struct vfsmount *mnt) | 2264 | void mnt_make_shortterm(struct vfsmount *mnt) |
2250 | { | 2265 | { |
2266 | #ifdef CONFIG_SMP | ||
2251 | if (atomic_add_unless(&mnt->mnt_longterm, -1, 1)) | 2267 | if (atomic_add_unless(&mnt->mnt_longterm, -1, 1)) |
2252 | return; | 2268 | return; |
2253 | br_write_lock(vfsmount_lock); | 2269 | br_write_lock(vfsmount_lock); |
2254 | atomic_dec(&mnt->mnt_longterm); | 2270 | atomic_dec(&mnt->mnt_longterm); |
2255 | br_write_unlock(vfsmount_lock); | 2271 | br_write_unlock(vfsmount_lock); |
2272 | #endif | ||
2256 | } | 2273 | } |
2257 | 2274 | ||
2258 | /* | 2275 | /* |
@@ -2292,17 +2309,17 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, | |||
2292 | q = new_ns->root; | 2309 | q = new_ns->root; |
2293 | while (p) { | 2310 | while (p) { |
2294 | q->mnt_ns = new_ns; | 2311 | q->mnt_ns = new_ns; |
2295 | atomic_inc(&q->mnt_longterm); | 2312 | __mnt_make_longterm(q); |
2296 | if (fs) { | 2313 | if (fs) { |
2297 | if (p == fs->root.mnt) { | 2314 | if (p == fs->root.mnt) { |
2298 | fs->root.mnt = mntget(q); | 2315 | fs->root.mnt = mntget(q); |
2299 | atomic_inc(&q->mnt_longterm); | 2316 | __mnt_make_longterm(q); |
2300 | mnt_make_shortterm(p); | 2317 | mnt_make_shortterm(p); |
2301 | rootmnt = p; | 2318 | rootmnt = p; |
2302 | } | 2319 | } |
2303 | if (p == fs->pwd.mnt) { | 2320 | if (p == fs->pwd.mnt) { |
2304 | fs->pwd.mnt = mntget(q); | 2321 | fs->pwd.mnt = mntget(q); |
2305 | atomic_inc(&q->mnt_longterm); | 2322 | __mnt_make_longterm(q); |
2306 | mnt_make_shortterm(p); | 2323 | mnt_make_shortterm(p); |
2307 | pwdmnt = p; | 2324 | pwdmnt = p; |
2308 | } | 2325 | } |
@@ -2348,7 +2365,7 @@ struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt) | |||
2348 | new_ns = alloc_mnt_ns(); | 2365 | new_ns = alloc_mnt_ns(); |
2349 | if (!IS_ERR(new_ns)) { | 2366 | if (!IS_ERR(new_ns)) { |
2350 | mnt->mnt_ns = new_ns; | 2367 | mnt->mnt_ns = new_ns; |
2351 | atomic_inc(&mnt->mnt_longterm); | 2368 | __mnt_make_longterm(mnt); |
2352 | new_ns->root = mnt; | 2369 | new_ns->root = mnt; |
2353 | list_add(&new_ns->list, &new_ns->root->mnt_list); | 2370 | list_add(&new_ns->list, &new_ns->root->mnt_list); |
2354 | } | 2371 | } |