aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
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 /fs/namespace.c
parent44d964d609c7c11b330a3d1caf30767fa13c7be3 (diff)
vfs: spread struct mount - do_umount/propagate_mount_busy
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c28
1 files changed, 14 insertions, 14 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 }