aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-16 14:49:45 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:12:53 -0400
commit328e6d9014636afc2b3c979403b36faadb412657 (patch)
tree711b12f8ba8bf1dcc4cdadd270a55dd7f9035e38 /fs
parent3ab6abee59ac9ca84cc4a1e31224f1dccd44394c (diff)
switch unlock_mount() to namespace_unlock(), convert all umount_tree() callers
which allows to kill the last argument of umount_tree() and make release_mounts() static. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c33
-rw-r--r--fs/pnode.c4
-rw-r--r--fs/pnode.h3
3 files changed, 16 insertions, 24 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 7563270a43ab..fa93d54d21e8 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1121,7 +1121,7 @@ EXPORT_SYMBOL(may_umount);
1121 1121
1122static LIST_HEAD(unmounted); /* protected by namespace_sem */ 1122static LIST_HEAD(unmounted); /* protected by namespace_sem */
1123 1123
1124void release_mounts(struct list_head *head) 1124static void release_mounts(struct list_head *head)
1125{ 1125{
1126 struct mount *mnt; 1126 struct mount *mnt;
1127 while (!list_empty(head)) { 1127 while (!list_empty(head)) {
@@ -1157,7 +1157,7 @@ static void namespace_unlock(void)
1157 * vfsmount lock must be held for write 1157 * vfsmount lock must be held for write
1158 * namespace_sem must be held for write 1158 * namespace_sem must be held for write
1159 */ 1159 */
1160void umount_tree(struct mount *mnt, int propagate, struct list_head *kill) 1160void umount_tree(struct mount *mnt, int propagate)
1161{ 1161{
1162 LIST_HEAD(tmp_list); 1162 LIST_HEAD(tmp_list);
1163 struct mount *p; 1163 struct mount *p;
@@ -1181,7 +1181,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1181 } 1181 }
1182 change_mnt_propagation(p, MS_PRIVATE); 1182 change_mnt_propagation(p, MS_PRIVATE);
1183 } 1183 }
1184 list_splice(&tmp_list, kill); 1184 list_splice(&tmp_list, &unmounted);
1185} 1185}
1186 1186
1187static void shrink_submounts(struct mount *mnt); 1187static void shrink_submounts(struct mount *mnt);
@@ -1190,7 +1190,6 @@ static int do_umount(struct mount *mnt, int flags)
1190{ 1190{
1191 struct super_block *sb = mnt->mnt.mnt_sb; 1191 struct super_block *sb = mnt->mnt.mnt_sb;
1192 int retval; 1192 int retval;
1193 LIST_HEAD(umount_list);
1194 1193
1195 retval = security_sb_umount(&mnt->mnt, flags); 1194 retval = security_sb_umount(&mnt->mnt, flags);
1196 if (retval) 1195 if (retval)
@@ -1267,7 +1266,7 @@ static int do_umount(struct mount *mnt, int flags)
1267 retval = -EBUSY; 1266 retval = -EBUSY;
1268 if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { 1267 if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) {
1269 if (!list_empty(&mnt->mnt_list)) 1268 if (!list_empty(&mnt->mnt_list))
1270 umount_tree(mnt, 1, &unmounted); 1269 umount_tree(mnt, 1);
1271 retval = 0; 1270 retval = 0;
1272 } 1271 }
1273 br_write_unlock(&vfsmount_lock); 1272 br_write_unlock(&vfsmount_lock);
@@ -1401,11 +1400,9 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1401 return res; 1400 return res;
1402out: 1401out:
1403 if (res) { 1402 if (res) {
1404 LIST_HEAD(umount_list);
1405 br_write_lock(&vfsmount_lock); 1403 br_write_lock(&vfsmount_lock);
1406 umount_tree(res, 0, &umount_list); 1404 umount_tree(res, 0);
1407 br_write_unlock(&vfsmount_lock); 1405 br_write_unlock(&vfsmount_lock);
1408 release_mounts(&umount_list);
1409 } 1406 }
1410 return q; 1407 return q;
1411} 1408}
@@ -1418,7 +1415,7 @@ struct vfsmount *collect_mounts(struct path *path)
1418 down_write(&namespace_sem); 1415 down_write(&namespace_sem);
1419 tree = copy_tree(real_mount(path->mnt), path->dentry, 1416 tree = copy_tree(real_mount(path->mnt), path->dentry,
1420 CL_COPY_ALL | CL_PRIVATE); 1417 CL_COPY_ALL | CL_PRIVATE);
1421 up_write(&namespace_sem); 1418 namespace_unlock();
1422 if (IS_ERR(tree)) 1419 if (IS_ERR(tree))
1423 return NULL; 1420 return NULL;
1424 return &tree->mnt; 1421 return &tree->mnt;
@@ -1428,7 +1425,7 @@ void drop_collected_mounts(struct vfsmount *mnt)
1428{ 1425{
1429 down_write(&namespace_sem); 1426 down_write(&namespace_sem);
1430 br_write_lock(&vfsmount_lock); 1427 br_write_lock(&vfsmount_lock);
1431 umount_tree(real_mount(mnt), 0, &unmounted); 1428 umount_tree(real_mount(mnt), 0);
1432 br_write_unlock(&vfsmount_lock); 1429 br_write_unlock(&vfsmount_lock);
1433 namespace_unlock(); 1430 namespace_unlock();
1434} 1431}
@@ -1619,7 +1616,7 @@ static void unlock_mount(struct mountpoint *where)
1619{ 1616{
1620 struct dentry *dentry = where->m_dentry; 1617 struct dentry *dentry = where->m_dentry;
1621 put_mountpoint(where); 1618 put_mountpoint(where);
1622 up_write(&namespace_sem); 1619 namespace_unlock();
1623 mutex_unlock(&dentry->d_inode->i_mutex); 1620 mutex_unlock(&dentry->d_inode->i_mutex);
1624} 1621}
1625 1622
@@ -1693,7 +1690,6 @@ static int do_change_type(struct path *path, int flag)
1693static int do_loopback(struct path *path, const char *old_name, 1690static int do_loopback(struct path *path, const char *old_name,
1694 int recurse) 1691 int recurse)
1695{ 1692{
1696 LIST_HEAD(umount_list);
1697 struct path old_path; 1693 struct path old_path;
1698 struct mount *mnt = NULL, *old, *parent; 1694 struct mount *mnt = NULL, *old, *parent;
1699 struct mountpoint *mp; 1695 struct mountpoint *mp;
@@ -1736,12 +1732,11 @@ static int do_loopback(struct path *path, const char *old_name,
1736 err = graft_tree(mnt, parent, mp); 1732 err = graft_tree(mnt, parent, mp);
1737 if (err) { 1733 if (err) {
1738 br_write_lock(&vfsmount_lock); 1734 br_write_lock(&vfsmount_lock);
1739 umount_tree(mnt, 0, &umount_list); 1735 umount_tree(mnt, 0);
1740 br_write_unlock(&vfsmount_lock); 1736 br_write_unlock(&vfsmount_lock);
1741 } 1737 }
1742out2: 1738out2:
1743 unlock_mount(mp); 1739 unlock_mount(mp);
1744 release_mounts(&umount_list);
1745out: 1740out:
1746 path_put(&old_path); 1741 path_put(&old_path);
1747 return err; 1742 return err;
@@ -2080,7 +2075,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
2080 while (!list_empty(&graveyard)) { 2075 while (!list_empty(&graveyard)) {
2081 mnt = list_first_entry(&graveyard, struct mount, mnt_expire); 2076 mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
2082 touch_mnt_namespace(mnt->mnt_ns); 2077 touch_mnt_namespace(mnt->mnt_ns);
2083 umount_tree(mnt, 1, &unmounted); 2078 umount_tree(mnt, 1);
2084 } 2079 }
2085 br_write_unlock(&vfsmount_lock); 2080 br_write_unlock(&vfsmount_lock);
2086 namespace_unlock(); 2081 namespace_unlock();
@@ -2151,7 +2146,7 @@ static void shrink_submounts(struct mount *mnt)
2151 m = list_first_entry(&graveyard, struct mount, 2146 m = list_first_entry(&graveyard, struct mount,
2152 mnt_expire); 2147 mnt_expire);
2153 touch_mnt_namespace(m->mnt_ns); 2148 touch_mnt_namespace(m->mnt_ns);
2154 umount_tree(m, 1, &unmounted); 2149 umount_tree(m, 1);
2155 } 2150 }
2156 } 2151 }
2157} 2152}
@@ -2385,7 +2380,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
2385 copy_flags |= CL_SHARED_TO_SLAVE; 2380 copy_flags |= CL_SHARED_TO_SLAVE;
2386 new = copy_tree(old, old->mnt.mnt_root, copy_flags); 2381 new = copy_tree(old, old->mnt.mnt_root, copy_flags);
2387 if (IS_ERR(new)) { 2382 if (IS_ERR(new)) {
2388 up_write(&namespace_sem); 2383 namespace_unlock();
2389 free_mnt_ns(new_ns); 2384 free_mnt_ns(new_ns);
2390 return ERR_CAST(new); 2385 return ERR_CAST(new);
2391 } 2386 }
@@ -2416,7 +2411,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
2416 p = next_mnt(p, old); 2411 p = next_mnt(p, old);
2417 q = next_mnt(q, new); 2412 q = next_mnt(q, new);
2418 } 2413 }
2419 up_write(&namespace_sem); 2414 namespace_unlock();
2420 2415
2421 if (rootmnt) 2416 if (rootmnt)
2422 mntput(rootmnt); 2417 mntput(rootmnt);
@@ -2740,7 +2735,7 @@ void put_mnt_ns(struct mnt_namespace *ns)
2740 return; 2735 return;
2741 down_write(&namespace_sem); 2736 down_write(&namespace_sem);
2742 br_write_lock(&vfsmount_lock); 2737 br_write_lock(&vfsmount_lock);
2743 umount_tree(ns->root, 0, &unmounted); 2738 umount_tree(ns->root, 0);
2744 br_write_unlock(&vfsmount_lock); 2739 br_write_unlock(&vfsmount_lock);
2745 namespace_unlock(); 2740 namespace_unlock();
2746 free_mnt_ns(ns); 2741 free_mnt_ns(ns);
diff --git a/fs/pnode.c b/fs/pnode.c
index 98e0d3a23fac..43617258fa6a 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -225,7 +225,6 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp,
225 struct mount *prev_dest_mnt = dest_mnt; 225 struct mount *prev_dest_mnt = dest_mnt;
226 struct mount *prev_src_mnt = source_mnt; 226 struct mount *prev_src_mnt = source_mnt;
227 LIST_HEAD(tmp_list); 227 LIST_HEAD(tmp_list);
228 LIST_HEAD(umount_list);
229 228
230 for (m = propagation_next(dest_mnt, dest_mnt); m; 229 for (m = propagation_next(dest_mnt, dest_mnt); m;
231 m = propagation_next(m, dest_mnt)) { 230 m = propagation_next(m, dest_mnt)) {
@@ -261,10 +260,9 @@ out:
261 br_write_lock(&vfsmount_lock); 260 br_write_lock(&vfsmount_lock);
262 while (!list_empty(&tmp_list)) { 261 while (!list_empty(&tmp_list)) {
263 child = list_first_entry(&tmp_list, struct mount, mnt_hash); 262 child = list_first_entry(&tmp_list, struct mount, mnt_hash);
264 umount_tree(child, 0, &umount_list); 263 umount_tree(child, 0);
265 } 264 }
266 br_write_unlock(&vfsmount_lock); 265 br_write_unlock(&vfsmount_lock);
267 release_mounts(&umount_list);
268 return ret; 266 return ret;
269} 267}
270 268
diff --git a/fs/pnode.h b/fs/pnode.h
index f4357d3a0a44..9eb00ee65bbe 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -40,8 +40,7 @@ int get_dominating_id(struct mount *mnt, const struct path *root);
40unsigned int mnt_get_count(struct mount *mnt); 40unsigned int mnt_get_count(struct mount *mnt);
41void mnt_set_mountpoint(struct mount *, struct mountpoint *, 41void mnt_set_mountpoint(struct mount *, struct mountpoint *,
42 struct mount *); 42 struct mount *);
43void release_mounts(struct list_head *); 43void umount_tree(struct mount *, int);
44void umount_tree(struct mount *, int, struct list_head *);
45struct mount *copy_tree(struct mount *, struct dentry *, int); 44struct mount *copy_tree(struct mount *, struct dentry *, int);
46bool is_path_reachable(struct mount *, struct dentry *, 45bool is_path_reachable(struct mount *, struct dentry *,
47 const struct path *root); 46 const struct path *root);