diff options
author | Andi Kleen <ak@linux.intel.com> | 2012-05-08 00:02:02 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-29 23:28:41 -0400 |
commit | 962830df366b66e71849040770ae6ba55a8b4aec (patch) | |
tree | 0af9487fd8d5a73fa7adbde0bed368ada4298e39 /fs/namespace.c | |
parent | eea62f831b8030b0eeea8314eed73b6132d1de26 (diff) |
brlocks/lglocks: API cleanups
lglocks and brlocks are currently generated with some complicated macros
in lglock.h. But there's no reason to not just use common utility
functions and put all the data into a common data structure.
In preparation, this patch changes the API to look more like normal
function calls with pointers, not magic macros.
The patch is rather large because I move over all users in one go to keep
it bisectable. This impacts the VFS somewhat in terms of lines changed.
But no actual behaviour change.
[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 139 |
1 files changed, 70 insertions, 69 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index e6081996c9a2..224aff1c0dfd 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -397,7 +397,7 @@ static int mnt_make_readonly(struct mount *mnt) | |||
397 | { | 397 | { |
398 | int ret = 0; | 398 | int ret = 0; |
399 | 399 | ||
400 | br_write_lock(vfsmount_lock); | 400 | br_write_lock(&vfsmount_lock); |
401 | mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; | 401 | mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; |
402 | /* | 402 | /* |
403 | * After storing MNT_WRITE_HOLD, we'll read the counters. This store | 403 | * After storing MNT_WRITE_HOLD, we'll read the counters. This store |
@@ -431,15 +431,15 @@ static int mnt_make_readonly(struct mount *mnt) | |||
431 | */ | 431 | */ |
432 | smp_wmb(); | 432 | smp_wmb(); |
433 | mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; | 433 | mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; |
434 | br_write_unlock(vfsmount_lock); | 434 | br_write_unlock(&vfsmount_lock); |
435 | return ret; | 435 | return ret; |
436 | } | 436 | } |
437 | 437 | ||
438 | static void __mnt_unmake_readonly(struct mount *mnt) | 438 | static void __mnt_unmake_readonly(struct mount *mnt) |
439 | { | 439 | { |
440 | br_write_lock(vfsmount_lock); | 440 | br_write_lock(&vfsmount_lock); |
441 | mnt->mnt.mnt_flags &= ~MNT_READONLY; | 441 | mnt->mnt.mnt_flags &= ~MNT_READONLY; |
442 | br_write_unlock(vfsmount_lock); | 442 | br_write_unlock(&vfsmount_lock); |
443 | } | 443 | } |
444 | 444 | ||
445 | int sb_prepare_remount_readonly(struct super_block *sb) | 445 | int sb_prepare_remount_readonly(struct super_block *sb) |
@@ -451,7 +451,7 @@ int sb_prepare_remount_readonly(struct super_block *sb) | |||
451 | if (atomic_long_read(&sb->s_remove_count)) | 451 | if (atomic_long_read(&sb->s_remove_count)) |
452 | return -EBUSY; | 452 | return -EBUSY; |
453 | 453 | ||
454 | br_write_lock(vfsmount_lock); | 454 | br_write_lock(&vfsmount_lock); |
455 | list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { | 455 | list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { |
456 | if (!(mnt->mnt.mnt_flags & MNT_READONLY)) { | 456 | if (!(mnt->mnt.mnt_flags & MNT_READONLY)) { |
457 | mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; | 457 | mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; |
@@ -473,7 +473,7 @@ int sb_prepare_remount_readonly(struct super_block *sb) | |||
473 | if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD) | 473 | if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD) |
474 | mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; | 474 | mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; |
475 | } | 475 | } |
476 | br_write_unlock(vfsmount_lock); | 476 | br_write_unlock(&vfsmount_lock); |
477 | 477 | ||
478 | return err; | 478 | return err; |
479 | } | 479 | } |
@@ -522,14 +522,14 @@ struct vfsmount *lookup_mnt(struct path *path) | |||
522 | { | 522 | { |
523 | struct mount *child_mnt; | 523 | struct mount *child_mnt; |
524 | 524 | ||
525 | br_read_lock(vfsmount_lock); | 525 | br_read_lock(&vfsmount_lock); |
526 | child_mnt = __lookup_mnt(path->mnt, path->dentry, 1); | 526 | child_mnt = __lookup_mnt(path->mnt, path->dentry, 1); |
527 | if (child_mnt) { | 527 | if (child_mnt) { |
528 | mnt_add_count(child_mnt, 1); | 528 | mnt_add_count(child_mnt, 1); |
529 | br_read_unlock(vfsmount_lock); | 529 | br_read_unlock(&vfsmount_lock); |
530 | return &child_mnt->mnt; | 530 | return &child_mnt->mnt; |
531 | } else { | 531 | } else { |
532 | br_read_unlock(vfsmount_lock); | 532 | br_read_unlock(&vfsmount_lock); |
533 | return NULL; | 533 | return NULL; |
534 | } | 534 | } |
535 | } | 535 | } |
@@ -714,9 +714,9 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
714 | mnt->mnt.mnt_sb = root->d_sb; | 714 | mnt->mnt.mnt_sb = root->d_sb; |
715 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; | 715 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; |
716 | mnt->mnt_parent = mnt; | 716 | mnt->mnt_parent = mnt; |
717 | br_write_lock(vfsmount_lock); | 717 | br_write_lock(&vfsmount_lock); |
718 | list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts); | 718 | list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts); |
719 | br_write_unlock(vfsmount_lock); | 719 | br_write_unlock(&vfsmount_lock); |
720 | return &mnt->mnt; | 720 | return &mnt->mnt; |
721 | } | 721 | } |
722 | EXPORT_SYMBOL_GPL(vfs_kern_mount); | 722 | EXPORT_SYMBOL_GPL(vfs_kern_mount); |
@@ -745,9 +745,9 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, | |||
745 | mnt->mnt.mnt_root = dget(root); | 745 | mnt->mnt.mnt_root = dget(root); |
746 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; | 746 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; |
747 | mnt->mnt_parent = mnt; | 747 | mnt->mnt_parent = mnt; |
748 | br_write_lock(vfsmount_lock); | 748 | br_write_lock(&vfsmount_lock); |
749 | list_add_tail(&mnt->mnt_instance, &sb->s_mounts); | 749 | list_add_tail(&mnt->mnt_instance, &sb->s_mounts); |
750 | br_write_unlock(vfsmount_lock); | 750 | br_write_unlock(&vfsmount_lock); |
751 | 751 | ||
752 | if (flag & CL_SLAVE) { | 752 | if (flag & CL_SLAVE) { |
753 | list_add(&mnt->mnt_slave, &old->mnt_slave_list); | 753 | list_add(&mnt->mnt_slave, &old->mnt_slave_list); |
@@ -803,35 +803,36 @@ static void mntput_no_expire(struct mount *mnt) | |||
803 | { | 803 | { |
804 | put_again: | 804 | put_again: |
805 | #ifdef CONFIG_SMP | 805 | #ifdef CONFIG_SMP |
806 | br_read_lock(vfsmount_lock); | 806 | br_read_lock(&vfsmount_lock); |
807 | if (likely(atomic_read(&mnt->mnt_longterm))) { | 807 | if (likely(atomic_read(&mnt->mnt_longterm))) { |
808 | mnt_add_count(mnt, -1); | 808 | mnt_add_count(mnt, -1); |
809 | br_read_unlock(vfsmount_lock); | 809 | br_read_unlock(&vfsmount_lock); |
810 | return; | 810 | return; |
811 | } | 811 | } |
812 | br_read_unlock(vfsmount_lock); | 812 | br_read_unlock(&vfsmount_lock); |
813 | 813 | ||
814 | br_write_lock(vfsmount_lock); | 814 | br_write_lock(&vfsmount_lock); |
815 | mnt_add_count(mnt, -1); | 815 | mnt_add_count(mnt, -1); |
816 | if (mnt_get_count(mnt)) { | 816 | if (mnt_get_count(mnt)) { |
817 | br_write_unlock(vfsmount_lock); | 817 | br_write_unlock(&vfsmount_lock); |
818 | return; | 818 | return; |
819 | } | 819 | } |
820 | #else | 820 | #else |
821 | mnt_add_count(mnt, -1); | 821 | mnt_add_count(mnt, -1); |
822 | if (likely(mnt_get_count(mnt))) | 822 | if (likely(mnt_get_count(mnt))) |
823 | return; | 823 | return; |
824 | br_write_lock(vfsmount_lock); | 824 | br_write_lock(&vfsmount_lock); |
825 | #endif | 825 | #endif |
826 | if (unlikely(mnt->mnt_pinned)) { | 826 | if (unlikely(mnt->mnt_pinned)) { |
827 | mnt_add_count(mnt, mnt->mnt_pinned + 1); | 827 | mnt_add_count(mnt, mnt->mnt_pinned + 1); |
828 | mnt->mnt_pinned = 0; | 828 | mnt->mnt_pinned = 0; |
829 | br_write_unlock(vfsmount_lock); | 829 | br_write_unlock(&vfsmount_lock); |
830 | acct_auto_close_mnt(&mnt->mnt); | 830 | acct_auto_close_mnt(&mnt->mnt); |
831 | goto put_again; | 831 | goto put_again; |
832 | } | 832 | } |
833 | |||
833 | list_del(&mnt->mnt_instance); | 834 | list_del(&mnt->mnt_instance); |
834 | br_write_unlock(vfsmount_lock); | 835 | br_write_unlock(&vfsmount_lock); |
835 | mntfree(mnt); | 836 | mntfree(mnt); |
836 | } | 837 | } |
837 | 838 | ||
@@ -857,21 +858,21 @@ EXPORT_SYMBOL(mntget); | |||
857 | 858 | ||
858 | void mnt_pin(struct vfsmount *mnt) | 859 | void mnt_pin(struct vfsmount *mnt) |
859 | { | 860 | { |
860 | br_write_lock(vfsmount_lock); | 861 | br_write_lock(&vfsmount_lock); |
861 | real_mount(mnt)->mnt_pinned++; | 862 | real_mount(mnt)->mnt_pinned++; |
862 | br_write_unlock(vfsmount_lock); | 863 | br_write_unlock(&vfsmount_lock); |
863 | } | 864 | } |
864 | EXPORT_SYMBOL(mnt_pin); | 865 | EXPORT_SYMBOL(mnt_pin); |
865 | 866 | ||
866 | void mnt_unpin(struct vfsmount *m) | 867 | void mnt_unpin(struct vfsmount *m) |
867 | { | 868 | { |
868 | struct mount *mnt = real_mount(m); | 869 | struct mount *mnt = real_mount(m); |
869 | br_write_lock(vfsmount_lock); | 870 | br_write_lock(&vfsmount_lock); |
870 | if (mnt->mnt_pinned) { | 871 | if (mnt->mnt_pinned) { |
871 | mnt_add_count(mnt, 1); | 872 | mnt_add_count(mnt, 1); |
872 | mnt->mnt_pinned--; | 873 | mnt->mnt_pinned--; |
873 | } | 874 | } |
874 | br_write_unlock(vfsmount_lock); | 875 | br_write_unlock(&vfsmount_lock); |
875 | } | 876 | } |
876 | EXPORT_SYMBOL(mnt_unpin); | 877 | EXPORT_SYMBOL(mnt_unpin); |
877 | 878 | ||
@@ -988,12 +989,12 @@ int may_umount_tree(struct vfsmount *m) | |||
988 | BUG_ON(!m); | 989 | BUG_ON(!m); |
989 | 990 | ||
990 | /* write lock needed for mnt_get_count */ | 991 | /* write lock needed for mnt_get_count */ |
991 | br_write_lock(vfsmount_lock); | 992 | br_write_lock(&vfsmount_lock); |
992 | for (p = mnt; p; p = next_mnt(p, mnt)) { | 993 | for (p = mnt; p; p = next_mnt(p, mnt)) { |
993 | actual_refs += mnt_get_count(p); | 994 | actual_refs += mnt_get_count(p); |
994 | minimum_refs += 2; | 995 | minimum_refs += 2; |
995 | } | 996 | } |
996 | br_write_unlock(vfsmount_lock); | 997 | br_write_unlock(&vfsmount_lock); |
997 | 998 | ||
998 | if (actual_refs > minimum_refs) | 999 | if (actual_refs > minimum_refs) |
999 | return 0; | 1000 | return 0; |
@@ -1020,10 +1021,10 @@ int may_umount(struct vfsmount *mnt) | |||
1020 | { | 1021 | { |
1021 | int ret = 1; | 1022 | int ret = 1; |
1022 | down_read(&namespace_sem); | 1023 | down_read(&namespace_sem); |
1023 | br_write_lock(vfsmount_lock); | 1024 | br_write_lock(&vfsmount_lock); |
1024 | if (propagate_mount_busy(real_mount(mnt), 2)) | 1025 | if (propagate_mount_busy(real_mount(mnt), 2)) |
1025 | ret = 0; | 1026 | ret = 0; |
1026 | br_write_unlock(vfsmount_lock); | 1027 | br_write_unlock(&vfsmount_lock); |
1027 | up_read(&namespace_sem); | 1028 | up_read(&namespace_sem); |
1028 | return ret; | 1029 | return ret; |
1029 | } | 1030 | } |
@@ -1040,13 +1041,13 @@ void release_mounts(struct list_head *head) | |||
1040 | struct dentry *dentry; | 1041 | struct dentry *dentry; |
1041 | struct mount *m; | 1042 | struct mount *m; |
1042 | 1043 | ||
1043 | br_write_lock(vfsmount_lock); | 1044 | br_write_lock(&vfsmount_lock); |
1044 | dentry = mnt->mnt_mountpoint; | 1045 | dentry = mnt->mnt_mountpoint; |
1045 | m = mnt->mnt_parent; | 1046 | m = mnt->mnt_parent; |
1046 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; | 1047 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; |
1047 | mnt->mnt_parent = mnt; | 1048 | mnt->mnt_parent = mnt; |
1048 | m->mnt_ghosts--; | 1049 | m->mnt_ghosts--; |
1049 | br_write_unlock(vfsmount_lock); | 1050 | br_write_unlock(&vfsmount_lock); |
1050 | dput(dentry); | 1051 | dput(dentry); |
1051 | mntput(&m->mnt); | 1052 | mntput(&m->mnt); |
1052 | } | 1053 | } |
@@ -1112,12 +1113,12 @@ static int do_umount(struct mount *mnt, int flags) | |||
1112 | * probably don't strictly need the lock here if we examined | 1113 | * probably don't strictly need the lock here if we examined |
1113 | * all race cases, but it's a slowpath. | 1114 | * all race cases, but it's a slowpath. |
1114 | */ | 1115 | */ |
1115 | br_write_lock(vfsmount_lock); | 1116 | br_write_lock(&vfsmount_lock); |
1116 | if (mnt_get_count(mnt) != 2) { | 1117 | if (mnt_get_count(mnt) != 2) { |
1117 | br_write_unlock(vfsmount_lock); | 1118 | br_write_unlock(&vfsmount_lock); |
1118 | return -EBUSY; | 1119 | return -EBUSY; |
1119 | } | 1120 | } |
1120 | br_write_unlock(vfsmount_lock); | 1121 | br_write_unlock(&vfsmount_lock); |
1121 | 1122 | ||
1122 | if (!xchg(&mnt->mnt_expiry_mark, 1)) | 1123 | if (!xchg(&mnt->mnt_expiry_mark, 1)) |
1123 | return -EAGAIN; | 1124 | return -EAGAIN; |
@@ -1159,7 +1160,7 @@ static int do_umount(struct mount *mnt, int flags) | |||
1159 | } | 1160 | } |
1160 | 1161 | ||
1161 | down_write(&namespace_sem); | 1162 | down_write(&namespace_sem); |
1162 | br_write_lock(vfsmount_lock); | 1163 | br_write_lock(&vfsmount_lock); |
1163 | event++; | 1164 | event++; |
1164 | 1165 | ||
1165 | if (!(flags & MNT_DETACH)) | 1166 | if (!(flags & MNT_DETACH)) |
@@ -1171,7 +1172,7 @@ static int do_umount(struct mount *mnt, int flags) | |||
1171 | umount_tree(mnt, 1, &umount_list); | 1172 | umount_tree(mnt, 1, &umount_list); |
1172 | retval = 0; | 1173 | retval = 0; |
1173 | } | 1174 | } |
1174 | br_write_unlock(vfsmount_lock); | 1175 | br_write_unlock(&vfsmount_lock); |
1175 | up_write(&namespace_sem); | 1176 | up_write(&namespace_sem); |
1176 | release_mounts(&umount_list); | 1177 | release_mounts(&umount_list); |
1177 | return retval; | 1178 | return retval; |
@@ -1286,19 +1287,19 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, | |||
1286 | q = clone_mnt(p, p->mnt.mnt_root, flag); | 1287 | q = clone_mnt(p, p->mnt.mnt_root, flag); |
1287 | if (!q) | 1288 | if (!q) |
1288 | goto Enomem; | 1289 | goto Enomem; |
1289 | br_write_lock(vfsmount_lock); | 1290 | br_write_lock(&vfsmount_lock); |
1290 | list_add_tail(&q->mnt_list, &res->mnt_list); | 1291 | list_add_tail(&q->mnt_list, &res->mnt_list); |
1291 | attach_mnt(q, &path); | 1292 | attach_mnt(q, &path); |
1292 | br_write_unlock(vfsmount_lock); | 1293 | br_write_unlock(&vfsmount_lock); |
1293 | } | 1294 | } |
1294 | } | 1295 | } |
1295 | return res; | 1296 | return res; |
1296 | Enomem: | 1297 | Enomem: |
1297 | if (res) { | 1298 | if (res) { |
1298 | LIST_HEAD(umount_list); | 1299 | LIST_HEAD(umount_list); |
1299 | br_write_lock(vfsmount_lock); | 1300 | br_write_lock(&vfsmount_lock); |
1300 | umount_tree(res, 0, &umount_list); | 1301 | umount_tree(res, 0, &umount_list); |
1301 | br_write_unlock(vfsmount_lock); | 1302 | br_write_unlock(&vfsmount_lock); |
1302 | release_mounts(&umount_list); | 1303 | release_mounts(&umount_list); |
1303 | } | 1304 | } |
1304 | return NULL; | 1305 | return NULL; |
@@ -1318,9 +1319,9 @@ void drop_collected_mounts(struct vfsmount *mnt) | |||
1318 | { | 1319 | { |
1319 | LIST_HEAD(umount_list); | 1320 | LIST_HEAD(umount_list); |
1320 | down_write(&namespace_sem); | 1321 | down_write(&namespace_sem); |
1321 | br_write_lock(vfsmount_lock); | 1322 | br_write_lock(&vfsmount_lock); |
1322 | umount_tree(real_mount(mnt), 0, &umount_list); | 1323 | umount_tree(real_mount(mnt), 0, &umount_list); |
1323 | br_write_unlock(vfsmount_lock); | 1324 | br_write_unlock(&vfsmount_lock); |
1324 | up_write(&namespace_sem); | 1325 | up_write(&namespace_sem); |
1325 | release_mounts(&umount_list); | 1326 | release_mounts(&umount_list); |
1326 | } | 1327 | } |
@@ -1448,7 +1449,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
1448 | if (err) | 1449 | if (err) |
1449 | goto out_cleanup_ids; | 1450 | goto out_cleanup_ids; |
1450 | 1451 | ||
1451 | br_write_lock(vfsmount_lock); | 1452 | br_write_lock(&vfsmount_lock); |
1452 | 1453 | ||
1453 | if (IS_MNT_SHARED(dest_mnt)) { | 1454 | if (IS_MNT_SHARED(dest_mnt)) { |
1454 | for (p = source_mnt; p; p = next_mnt(p, source_mnt)) | 1455 | for (p = source_mnt; p; p = next_mnt(p, source_mnt)) |
@@ -1467,7 +1468,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
1467 | list_del_init(&child->mnt_hash); | 1468 | list_del_init(&child->mnt_hash); |
1468 | commit_tree(child); | 1469 | commit_tree(child); |
1469 | } | 1470 | } |
1470 | br_write_unlock(vfsmount_lock); | 1471 | br_write_unlock(&vfsmount_lock); |
1471 | 1472 | ||
1472 | return 0; | 1473 | return 0; |
1473 | 1474 | ||
@@ -1565,10 +1566,10 @@ static int do_change_type(struct path *path, int flag) | |||
1565 | goto out_unlock; | 1566 | goto out_unlock; |
1566 | } | 1567 | } |
1567 | 1568 | ||
1568 | br_write_lock(vfsmount_lock); | 1569 | br_write_lock(&vfsmount_lock); |
1569 | for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL)) | 1570 | for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL)) |
1570 | change_mnt_propagation(m, type); | 1571 | change_mnt_propagation(m, type); |
1571 | br_write_unlock(vfsmount_lock); | 1572 | br_write_unlock(&vfsmount_lock); |
1572 | 1573 | ||
1573 | out_unlock: | 1574 | out_unlock: |
1574 | up_write(&namespace_sem); | 1575 | up_write(&namespace_sem); |
@@ -1617,9 +1618,9 @@ static int do_loopback(struct path *path, char *old_name, | |||
1617 | 1618 | ||
1618 | err = graft_tree(mnt, path); | 1619 | err = graft_tree(mnt, path); |
1619 | if (err) { | 1620 | if (err) { |
1620 | br_write_lock(vfsmount_lock); | 1621 | br_write_lock(&vfsmount_lock); |
1621 | umount_tree(mnt, 0, &umount_list); | 1622 | umount_tree(mnt, 0, &umount_list); |
1622 | br_write_unlock(vfsmount_lock); | 1623 | br_write_unlock(&vfsmount_lock); |
1623 | } | 1624 | } |
1624 | out2: | 1625 | out2: |
1625 | unlock_mount(path); | 1626 | unlock_mount(path); |
@@ -1677,16 +1678,16 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | |||
1677 | else | 1678 | else |
1678 | err = do_remount_sb(sb, flags, data, 0); | 1679 | err = do_remount_sb(sb, flags, data, 0); |
1679 | if (!err) { | 1680 | if (!err) { |
1680 | br_write_lock(vfsmount_lock); | 1681 | br_write_lock(&vfsmount_lock); |
1681 | mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK; | 1682 | mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK; |
1682 | mnt->mnt.mnt_flags = mnt_flags; | 1683 | mnt->mnt.mnt_flags = mnt_flags; |
1683 | br_write_unlock(vfsmount_lock); | 1684 | br_write_unlock(&vfsmount_lock); |
1684 | } | 1685 | } |
1685 | up_write(&sb->s_umount); | 1686 | up_write(&sb->s_umount); |
1686 | if (!err) { | 1687 | if (!err) { |
1687 | br_write_lock(vfsmount_lock); | 1688 | br_write_lock(&vfsmount_lock); |
1688 | touch_mnt_namespace(mnt->mnt_ns); | 1689 | touch_mnt_namespace(mnt->mnt_ns); |
1689 | br_write_unlock(vfsmount_lock); | 1690 | br_write_unlock(&vfsmount_lock); |
1690 | } | 1691 | } |
1691 | return err; | 1692 | return err; |
1692 | } | 1693 | } |
@@ -1893,9 +1894,9 @@ fail: | |||
1893 | /* remove m from any expiration list it may be on */ | 1894 | /* remove m from any expiration list it may be on */ |
1894 | if (!list_empty(&mnt->mnt_expire)) { | 1895 | if (!list_empty(&mnt->mnt_expire)) { |
1895 | down_write(&namespace_sem); | 1896 | down_write(&namespace_sem); |
1896 | br_write_lock(vfsmount_lock); | 1897 | br_write_lock(&vfsmount_lock); |
1897 | list_del_init(&mnt->mnt_expire); | 1898 | list_del_init(&mnt->mnt_expire); |
1898 | br_write_unlock(vfsmount_lock); | 1899 | br_write_unlock(&vfsmount_lock); |
1899 | up_write(&namespace_sem); | 1900 | up_write(&namespace_sem); |
1900 | } | 1901 | } |
1901 | mntput(m); | 1902 | mntput(m); |
@@ -1911,11 +1912,11 @@ fail: | |||
1911 | void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list) | 1912 | void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list) |
1912 | { | 1913 | { |
1913 | down_write(&namespace_sem); | 1914 | down_write(&namespace_sem); |
1914 | br_write_lock(vfsmount_lock); | 1915 | br_write_lock(&vfsmount_lock); |
1915 | 1916 | ||
1916 | list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list); | 1917 | list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list); |
1917 | 1918 | ||
1918 | br_write_unlock(vfsmount_lock); | 1919 | br_write_unlock(&vfsmount_lock); |
1919 | up_write(&namespace_sem); | 1920 | up_write(&namespace_sem); |
1920 | } | 1921 | } |
1921 | EXPORT_SYMBOL(mnt_set_expiry); | 1922 | EXPORT_SYMBOL(mnt_set_expiry); |
@@ -1935,7 +1936,7 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
1935 | return; | 1936 | return; |
1936 | 1937 | ||
1937 | down_write(&namespace_sem); | 1938 | down_write(&namespace_sem); |
1938 | br_write_lock(vfsmount_lock); | 1939 | br_write_lock(&vfsmount_lock); |
1939 | 1940 | ||
1940 | /* extract from the expiration list every vfsmount that matches the | 1941 | /* extract from the expiration list every vfsmount that matches the |
1941 | * following criteria: | 1942 | * following criteria: |
@@ -1954,7 +1955,7 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
1954 | touch_mnt_namespace(mnt->mnt_ns); | 1955 | touch_mnt_namespace(mnt->mnt_ns); |
1955 | umount_tree(mnt, 1, &umounts); | 1956 | umount_tree(mnt, 1, &umounts); |
1956 | } | 1957 | } |
1957 | br_write_unlock(vfsmount_lock); | 1958 | br_write_unlock(&vfsmount_lock); |
1958 | up_write(&namespace_sem); | 1959 | up_write(&namespace_sem); |
1959 | 1960 | ||
1960 | release_mounts(&umounts); | 1961 | release_mounts(&umounts); |
@@ -2218,9 +2219,9 @@ void mnt_make_shortterm(struct vfsmount *m) | |||
2218 | struct mount *mnt = real_mount(m); | 2219 | struct mount *mnt = real_mount(m); |
2219 | if (atomic_add_unless(&mnt->mnt_longterm, -1, 1)) | 2220 | if (atomic_add_unless(&mnt->mnt_longterm, -1, 1)) |
2220 | return; | 2221 | return; |
2221 | br_write_lock(vfsmount_lock); | 2222 | br_write_lock(&vfsmount_lock); |
2222 | atomic_dec(&mnt->mnt_longterm); | 2223 | atomic_dec(&mnt->mnt_longterm); |
2223 | br_write_unlock(vfsmount_lock); | 2224 | br_write_unlock(&vfsmount_lock); |
2224 | #endif | 2225 | #endif |
2225 | } | 2226 | } |
2226 | 2227 | ||
@@ -2250,9 +2251,9 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, | |||
2250 | return ERR_PTR(-ENOMEM); | 2251 | return ERR_PTR(-ENOMEM); |
2251 | } | 2252 | } |
2252 | new_ns->root = new; | 2253 | new_ns->root = new; |
2253 | br_write_lock(vfsmount_lock); | 2254 | br_write_lock(&vfsmount_lock); |
2254 | list_add_tail(&new_ns->list, &new->mnt_list); | 2255 | list_add_tail(&new_ns->list, &new->mnt_list); |
2255 | br_write_unlock(vfsmount_lock); | 2256 | br_write_unlock(&vfsmount_lock); |
2256 | 2257 | ||
2257 | /* | 2258 | /* |
2258 | * Second pass: switch the tsk->fs->* elements and mark new vfsmounts | 2259 | * Second pass: switch the tsk->fs->* elements and mark new vfsmounts |
@@ -2416,9 +2417,9 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry, | |||
2416 | int path_is_under(struct path *path1, struct path *path2) | 2417 | int path_is_under(struct path *path1, struct path *path2) |
2417 | { | 2418 | { |
2418 | int res; | 2419 | int res; |
2419 | br_read_lock(vfsmount_lock); | 2420 | br_read_lock(&vfsmount_lock); |
2420 | res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); | 2421 | res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); |
2421 | br_read_unlock(vfsmount_lock); | 2422 | br_read_unlock(&vfsmount_lock); |
2422 | return res; | 2423 | return res; |
2423 | } | 2424 | } |
2424 | EXPORT_SYMBOL(path_is_under); | 2425 | EXPORT_SYMBOL(path_is_under); |
@@ -2505,7 +2506,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, | |||
2505 | /* make sure we can reach put_old from new_root */ | 2506 | /* make sure we can reach put_old from new_root */ |
2506 | if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new)) | 2507 | if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new)) |
2507 | goto out4; | 2508 | goto out4; |
2508 | br_write_lock(vfsmount_lock); | 2509 | br_write_lock(&vfsmount_lock); |
2509 | detach_mnt(new_mnt, &parent_path); | 2510 | detach_mnt(new_mnt, &parent_path); |
2510 | detach_mnt(root_mnt, &root_parent); | 2511 | detach_mnt(root_mnt, &root_parent); |
2511 | /* mount old root on put_old */ | 2512 | /* mount old root on put_old */ |
@@ -2513,7 +2514,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, | |||
2513 | /* mount new_root on / */ | 2514 | /* mount new_root on / */ |
2514 | attach_mnt(new_mnt, &root_parent); | 2515 | attach_mnt(new_mnt, &root_parent); |
2515 | touch_mnt_namespace(current->nsproxy->mnt_ns); | 2516 | touch_mnt_namespace(current->nsproxy->mnt_ns); |
2516 | br_write_unlock(vfsmount_lock); | 2517 | br_write_unlock(&vfsmount_lock); |
2517 | chroot_fs_refs(&root, &new); | 2518 | chroot_fs_refs(&root, &new); |
2518 | error = 0; | 2519 | error = 0; |
2519 | out4: | 2520 | out4: |
@@ -2576,7 +2577,7 @@ void __init mnt_init(void) | |||
2576 | for (u = 0; u < HASH_SIZE; u++) | 2577 | for (u = 0; u < HASH_SIZE; u++) |
2577 | INIT_LIST_HEAD(&mount_hashtable[u]); | 2578 | INIT_LIST_HEAD(&mount_hashtable[u]); |
2578 | 2579 | ||
2579 | br_lock_init(vfsmount_lock); | 2580 | br_lock_init(&vfsmount_lock); |
2580 | 2581 | ||
2581 | err = sysfs_init(); | 2582 | err = sysfs_init(); |
2582 | if (err) | 2583 | if (err) |
@@ -2596,9 +2597,9 @@ void put_mnt_ns(struct mnt_namespace *ns) | |||
2596 | if (!atomic_dec_and_test(&ns->count)) | 2597 | if (!atomic_dec_and_test(&ns->count)) |
2597 | return; | 2598 | return; |
2598 | down_write(&namespace_sem); | 2599 | down_write(&namespace_sem); |
2599 | br_write_lock(vfsmount_lock); | 2600 | br_write_lock(&vfsmount_lock); |
2600 | umount_tree(ns->root, 0, &umount_list); | 2601 | umount_tree(ns->root, 0, &umount_list); |
2601 | br_write_unlock(vfsmount_lock); | 2602 | br_write_unlock(&vfsmount_lock); |
2602 | up_write(&namespace_sem); | 2603 | up_write(&namespace_sem); |
2603 | release_mounts(&umount_list); | 2604 | release_mounts(&umount_list); |
2604 | kfree(ns); | 2605 | kfree(ns); |