summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-24 21:35:16 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:03 -0500
commit1ab597386205f8dc757cf8750465502aeae65154 (patch)
tree69a8ad9eeafe3fd358151c26002cbab6d2215f28
parent44d964d609c7c11b330a3d1caf30767fa13c7be3 (diff)
vfs: spread struct mount - do_umount/propagate_mount_busy
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namespace.c28
-rw-r--r--fs/pnode.c16
-rw-r--r--fs/pnode.h2
3 files changed, 23 insertions, 23 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index c11b99af53cf..17927f9eeca4 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1180,7 +1180,7 @@ int may_umount(struct vfsmount *mnt)
1180 int ret = 1; 1180 int ret = 1;
1181 down_read(&namespace_sem); 1181 down_read(&namespace_sem);
1182 br_write_lock(vfsmount_lock); 1182 br_write_lock(vfsmount_lock);
1183 if (propagate_mount_busy(mnt, 2)) 1183 if (propagate_mount_busy(real_mount(mnt), 2))
1184 ret = 0; 1184 ret = 0;
1185 br_write_unlock(vfsmount_lock); 1185 br_write_unlock(vfsmount_lock);
1186 up_read(&namespace_sem); 1186 up_read(&namespace_sem);
@@ -1246,13 +1246,13 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1246 1246
1247static void shrink_submounts(struct mount *mnt, struct list_head *umounts); 1247static void shrink_submounts(struct mount *mnt, struct list_head *umounts);
1248 1248
1249static int do_umount(struct vfsmount *mnt, int flags) 1249static int do_umount(struct mount *mnt, int flags)
1250{ 1250{
1251 struct super_block *sb = mnt->mnt_sb; 1251 struct super_block *sb = mnt->mnt.mnt_sb;
1252 int retval; 1252 int retval;
1253 LIST_HEAD(umount_list); 1253 LIST_HEAD(umount_list);
1254 1254
1255 retval = security_sb_umount(mnt, flags); 1255 retval = security_sb_umount(&mnt->mnt, flags);
1256 if (retval) 1256 if (retval)
1257 return retval; 1257 return retval;
1258 1258
@@ -1263,7 +1263,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1263 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount] 1263 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
1264 */ 1264 */
1265 if (flags & MNT_EXPIRE) { 1265 if (flags & MNT_EXPIRE) {
1266 if (mnt == current->fs->root.mnt || 1266 if (&mnt->mnt == current->fs->root.mnt ||
1267 flags & (MNT_FORCE | MNT_DETACH)) 1267 flags & (MNT_FORCE | MNT_DETACH))
1268 return -EINVAL; 1268 return -EINVAL;
1269 1269
@@ -1272,13 +1272,13 @@ static int do_umount(struct vfsmount *mnt, int flags)
1272 * all race cases, but it's a slowpath. 1272 * all race cases, but it's a slowpath.
1273 */ 1273 */
1274 br_write_lock(vfsmount_lock); 1274 br_write_lock(vfsmount_lock);
1275 if (mnt_get_count(mnt) != 2) { 1275 if (mnt_get_count(&mnt->mnt) != 2) {
1276 br_write_unlock(vfsmount_lock); 1276 br_write_unlock(vfsmount_lock);
1277 return -EBUSY; 1277 return -EBUSY;
1278 } 1278 }
1279 br_write_unlock(vfsmount_lock); 1279 br_write_unlock(vfsmount_lock);
1280 1280
1281 if (!xchg(&mnt->mnt_expiry_mark, 1)) 1281 if (!xchg(&mnt->mnt.mnt_expiry_mark, 1))
1282 return -EAGAIN; 1282 return -EAGAIN;
1283 } 1283 }
1284 1284
@@ -1305,7 +1305,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1305 * /reboot - static binary that would close all descriptors and 1305 * /reboot - static binary that would close all descriptors and
1306 * call reboot(9). Then init(8) could umount root and exec /reboot. 1306 * call reboot(9). Then init(8) could umount root and exec /reboot.
1307 */ 1307 */
1308 if (mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) { 1308 if (&mnt->mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
1309 /* 1309 /*
1310 * Special case for "unmounting" root ... 1310 * Special case for "unmounting" root ...
1311 * we just try to remount it readonly. 1311 * we just try to remount it readonly.
@@ -1322,12 +1322,12 @@ static int do_umount(struct vfsmount *mnt, int flags)
1322 event++; 1322 event++;
1323 1323
1324 if (!(flags & MNT_DETACH)) 1324 if (!(flags & MNT_DETACH))
1325 shrink_submounts(real_mount(mnt), &umount_list); 1325 shrink_submounts(mnt, &umount_list);
1326 1326
1327 retval = -EBUSY; 1327 retval = -EBUSY;
1328 if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { 1328 if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) {
1329 if (!list_empty(&mnt->mnt_list)) 1329 if (!list_empty(&mnt->mnt.mnt_list))
1330 umount_tree(real_mount(mnt), 1, &umount_list); 1330 umount_tree(mnt, 1, &umount_list);
1331 retval = 0; 1331 retval = 0;
1332 } 1332 }
1333 br_write_unlock(vfsmount_lock); 1333 br_write_unlock(vfsmount_lock);
@@ -1369,7 +1369,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1369 if (!capable(CAP_SYS_ADMIN)) 1369 if (!capable(CAP_SYS_ADMIN))
1370 goto dput_and_out; 1370 goto dput_and_out;
1371 1371
1372 retval = do_umount(path.mnt, flags); 1372 retval = do_umount(real_mount(path.mnt), flags);
1373dput_and_out: 1373dput_and_out:
1374 /* we mustn't call path_put() as that would clear mnt_expiry_mark */ 1374 /* we mustn't call path_put() as that would clear mnt_expiry_mark */
1375 dput(path.dentry); 1375 dput(path.dentry);
@@ -2101,7 +2101,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
2101 */ 2101 */
2102 list_for_each_entry_safe(mnt, next, mounts, mnt.mnt_expire) { 2102 list_for_each_entry_safe(mnt, next, mounts, mnt.mnt_expire) {
2103 if (!xchg(&mnt->mnt.mnt_expiry_mark, 1) || 2103 if (!xchg(&mnt->mnt.mnt_expiry_mark, 1) ||
2104 propagate_mount_busy(&mnt->mnt, 1)) 2104 propagate_mount_busy(mnt, 1))
2105 continue; 2105 continue;
2106 list_move(&mnt->mnt.mnt_expire, &graveyard); 2106 list_move(&mnt->mnt.mnt_expire, &graveyard);
2107 } 2107 }
@@ -2148,7 +2148,7 @@ resume:
2148 goto repeat; 2148 goto repeat;
2149 } 2149 }
2150 2150
2151 if (!propagate_mount_busy(&mnt->mnt, 1)) { 2151 if (!propagate_mount_busy(mnt, 1)) {
2152 list_move_tail(&mnt->mnt.mnt_expire, graveyard); 2152 list_move_tail(&mnt->mnt.mnt_expire, graveyard);
2153 found++; 2153 found++;
2154 } 2154 }
diff --git a/fs/pnode.c b/fs/pnode.c
index 89ea50dc2af3..3105cca197ec 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -272,9 +272,9 @@ out:
272/* 272/*
273 * return true if the refcount is greater than count 273 * return true if the refcount is greater than count
274 */ 274 */
275static inline int do_refcount_check(struct vfsmount *mnt, int count) 275static inline int do_refcount_check(struct mount *mnt, int count)
276{ 276{
277 int mycount = mnt_get_count(mnt) - mnt->mnt_ghosts; 277 int mycount = mnt_get_count(&mnt->mnt) - mnt->mnt.mnt_ghosts;
278 return (mycount > count); 278 return (mycount > count);
279} 279}
280 280
@@ -288,14 +288,14 @@ static inline int do_refcount_check(struct vfsmount *mnt, int count)
288 * 288 *
289 * vfsmount lock must be held for write 289 * vfsmount lock must be held for write
290 */ 290 */
291int propagate_mount_busy(struct vfsmount *mnt, int refcnt) 291int propagate_mount_busy(struct mount *mnt, int refcnt)
292{ 292{
293 struct vfsmount *m; 293 struct vfsmount *m;
294 struct mount *child; 294 struct mount *child;
295 struct vfsmount *parent = mnt->mnt_parent; 295 struct vfsmount *parent = mnt->mnt.mnt_parent;
296 int ret = 0; 296 int ret = 0;
297 297
298 if (mnt == parent) 298 if (&mnt->mnt == parent)
299 return do_refcount_check(mnt, refcnt); 299 return do_refcount_check(mnt, refcnt);
300 300
301 /* 301 /*
@@ -303,14 +303,14 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
303 * If not, we don't have to go checking for all other 303 * If not, we don't have to go checking for all other
304 * mounts 304 * mounts
305 */ 305 */
306 if (!list_empty(&mnt->mnt_mounts) || do_refcount_check(mnt, refcnt)) 306 if (!list_empty(&mnt->mnt.mnt_mounts) || do_refcount_check(mnt, refcnt))
307 return 1; 307 return 1;
308 308
309 for (m = propagation_next(parent, parent); m; 309 for (m = propagation_next(parent, parent); m;
310 m = propagation_next(m, parent)) { 310 m = propagation_next(m, parent)) {
311 child = __lookup_mnt(m, mnt->mnt_mountpoint, 0); 311 child = __lookup_mnt(m, mnt->mnt.mnt_mountpoint, 0);
312 if (child && list_empty(&child->mnt.mnt_mounts) && 312 if (child && list_empty(&child->mnt.mnt_mounts) &&
313 (ret = do_refcount_check(&child->mnt, 1))) 313 (ret = do_refcount_check(child, 1)))
314 break; 314 break;
315 } 315 }
316 return ret; 316 return ret;
diff --git a/fs/pnode.h b/fs/pnode.h
index bfd0bbcabf6d..f1d251d3771e 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -33,7 +33,7 @@ void change_mnt_propagation(struct mount *, int);
33int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, 33int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *,
34 struct list_head *); 34 struct list_head *);
35int propagate_umount(struct list_head *); 35int propagate_umount(struct list_head *);
36int propagate_mount_busy(struct vfsmount *, int); 36int propagate_mount_busy(struct mount *, int);
37void mnt_release_group_id(struct mount *); 37void mnt_release_group_id(struct mount *);
38int get_dominating_id(struct vfsmount *mnt, const struct path *root); 38int get_dominating_id(struct vfsmount *mnt, const struct path *root);
39unsigned int mnt_get_count(struct vfsmount *mnt); 39unsigned int mnt_get_count(struct vfsmount *mnt);