|
@@ -397,7 +397,7 @@ static int mnt_make_readonly(struct mount *mnt)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
/*
|
|
/*
|
|
* After storing MNT_WRITE_HOLD, we'll read the counters. This store
|
|
* After storing MNT_WRITE_HOLD, we'll read the counters. This store
|
|
@@ -431,15 +431,15 @@ static int mnt_make_readonly(struct mount *mnt)
|
|
*/
|
|
*/
|
|
smp_wmb();
|
|
smp_wmb();
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static void __mnt_unmake_readonly(struct mount *mnt)
|
|
static void __mnt_unmake_readonly(struct mount *mnt)
|
|
{
|
|
{
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
mnt->mnt.mnt_flags &= ~MNT_READONLY;
|
|
mnt->mnt.mnt_flags &= ~MNT_READONLY;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
|
|
|
|
int sb_prepare_remount_readonly(struct super_block *sb)
|
|
int sb_prepare_remount_readonly(struct super_block *sb)
|
|
@@ -451,7 +451,7 @@ int sb_prepare_remount_readonly(struct super_block *sb)
|
|
if (atomic_long_read(&sb->s_remove_count))
|
|
if (atomic_long_read(&sb->s_remove_count))
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
|
|
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
|
|
if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
|
|
if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
|
|
@@ -473,7 +473,7 @@ int sb_prepare_remount_readonly(struct super_block *sb)
|
|
if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD)
|
|
if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD)
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -522,14 +522,14 @@ struct vfsmount *lookup_mnt(struct path *path)
|
|
{
|
|
{
|
|
struct mount *child_mnt;
|
|
struct mount *child_mnt;
|
|
|
|
|
|
- br_read_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_lock(&vfsmount_lock);
|
|
child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
|
|
child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
|
|
if (child_mnt) {
|
|
if (child_mnt) {
|
|
mnt_add_count(child_mnt, 1);
|
|
mnt_add_count(child_mnt, 1);
|
|
- br_read_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_unlock(&vfsmount_lock);
|
|
return &child_mnt->mnt;
|
|
return &child_mnt->mnt;
|
|
} else {
|
|
} else {
|
|
- br_read_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_unlock(&vfsmount_lock);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -714,9 +714,9 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
|
|
mnt->mnt.mnt_sb = root->d_sb;
|
|
mnt->mnt.mnt_sb = root->d_sb;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_parent = mnt;
|
|
mnt->mnt_parent = mnt;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts);
|
|
list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
return &mnt->mnt;
|
|
return &mnt->mnt;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(vfs_kern_mount);
|
|
EXPORT_SYMBOL_GPL(vfs_kern_mount);
|
|
@@ -745,9 +745,9 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
|
|
mnt->mnt.mnt_root = dget(root);
|
|
mnt->mnt.mnt_root = dget(root);
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_parent = mnt;
|
|
mnt->mnt_parent = mnt;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
|
|
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
if (flag & CL_SLAVE) {
|
|
if (flag & CL_SLAVE) {
|
|
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
|
|
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
|
|
@@ -803,35 +803,36 @@ static void mntput_no_expire(struct mount *mnt)
|
|
{
|
|
{
|
|
put_again:
|
|
put_again:
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
- br_read_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_lock(&vfsmount_lock);
|
|
if (likely(atomic_read(&mnt->mnt_longterm))) {
|
|
if (likely(atomic_read(&mnt->mnt_longterm))) {
|
|
mnt_add_count(mnt, -1);
|
|
mnt_add_count(mnt, -1);
|
|
- br_read_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_unlock(&vfsmount_lock);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- br_read_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_unlock(&vfsmount_lock);
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
mnt_add_count(mnt, -1);
|
|
mnt_add_count(mnt, -1);
|
|
if (mnt_get_count(mnt)) {
|
|
if (mnt_get_count(mnt)) {
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
#else
|
|
#else
|
|
mnt_add_count(mnt, -1);
|
|
mnt_add_count(mnt, -1);
|
|
if (likely(mnt_get_count(mnt)))
|
|
if (likely(mnt_get_count(mnt)))
|
|
return;
|
|
return;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
#endif
|
|
#endif
|
|
if (unlikely(mnt->mnt_pinned)) {
|
|
if (unlikely(mnt->mnt_pinned)) {
|
|
mnt_add_count(mnt, mnt->mnt_pinned + 1);
|
|
mnt_add_count(mnt, mnt->mnt_pinned + 1);
|
|
mnt->mnt_pinned = 0;
|
|
mnt->mnt_pinned = 0;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
acct_auto_close_mnt(&mnt->mnt);
|
|
acct_auto_close_mnt(&mnt->mnt);
|
|
goto put_again;
|
|
goto put_again;
|
|
}
|
|
}
|
|
|
|
+
|
|
list_del(&mnt->mnt_instance);
|
|
list_del(&mnt->mnt_instance);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
mntfree(mnt);
|
|
mntfree(mnt);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -857,21 +858,21 @@ EXPORT_SYMBOL(mntget);
|
|
|
|
|
|
void mnt_pin(struct vfsmount *mnt)
|
|
void mnt_pin(struct vfsmount *mnt)
|
|
{
|
|
{
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
real_mount(mnt)->mnt_pinned++;
|
|
real_mount(mnt)->mnt_pinned++;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mnt_pin);
|
|
EXPORT_SYMBOL(mnt_pin);
|
|
|
|
|
|
void mnt_unpin(struct vfsmount *m)
|
|
void mnt_unpin(struct vfsmount *m)
|
|
{
|
|
{
|
|
struct mount *mnt = real_mount(m);
|
|
struct mount *mnt = real_mount(m);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
if (mnt->mnt_pinned) {
|
|
if (mnt->mnt_pinned) {
|
|
mnt_add_count(mnt, 1);
|
|
mnt_add_count(mnt, 1);
|
|
mnt->mnt_pinned--;
|
|
mnt->mnt_pinned--;
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mnt_unpin);
|
|
EXPORT_SYMBOL(mnt_unpin);
|
|
|
|
|
|
@@ -988,12 +989,12 @@ int may_umount_tree(struct vfsmount *m)
|
|
BUG_ON(!m);
|
|
BUG_ON(!m);
|
|
|
|
|
|
/* write lock needed for mnt_get_count */
|
|
/* write lock needed for mnt_get_count */
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
for (p = mnt; p; p = next_mnt(p, mnt)) {
|
|
for (p = mnt; p; p = next_mnt(p, mnt)) {
|
|
actual_refs += mnt_get_count(p);
|
|
actual_refs += mnt_get_count(p);
|
|
minimum_refs += 2;
|
|
minimum_refs += 2;
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
if (actual_refs > minimum_refs)
|
|
if (actual_refs > minimum_refs)
|
|
return 0;
|
|
return 0;
|
|
@@ -1020,10 +1021,10 @@ int may_umount(struct vfsmount *mnt)
|
|
{
|
|
{
|
|
int ret = 1;
|
|
int ret = 1;
|
|
down_read(&namespace_sem);
|
|
down_read(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
if (propagate_mount_busy(real_mount(mnt), 2))
|
|
if (propagate_mount_busy(real_mount(mnt), 2))
|
|
ret = 0;
|
|
ret = 0;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_read(&namespace_sem);
|
|
up_read(&namespace_sem);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -1040,13 +1041,13 @@ void release_mounts(struct list_head *head)
|
|
struct dentry *dentry;
|
|
struct dentry *dentry;
|
|
struct mount *m;
|
|
struct mount *m;
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
dentry = mnt->mnt_mountpoint;
|
|
dentry = mnt->mnt_mountpoint;
|
|
m = mnt->mnt_parent;
|
|
m = mnt->mnt_parent;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
|
mnt->mnt_parent = mnt;
|
|
mnt->mnt_parent = mnt;
|
|
m->mnt_ghosts--;
|
|
m->mnt_ghosts--;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
dput(dentry);
|
|
dput(dentry);
|
|
mntput(&m->mnt);
|
|
mntput(&m->mnt);
|
|
}
|
|
}
|
|
@@ -1112,12 +1113,12 @@ static int do_umount(struct mount *mnt, int flags)
|
|
* probably don't strictly need the lock here if we examined
|
|
* probably don't strictly need the lock here if we examined
|
|
* all race cases, but it's a slowpath.
|
|
* all race cases, but it's a slowpath.
|
|
*/
|
|
*/
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
if (mnt_get_count(mnt) != 2) {
|
|
if (mnt_get_count(mnt) != 2) {
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
if (!xchg(&mnt->mnt_expiry_mark, 1))
|
|
if (!xchg(&mnt->mnt_expiry_mark, 1))
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
@@ -1159,7 +1160,7 @@ static int do_umount(struct mount *mnt, int flags)
|
|
}
|
|
}
|
|
|
|
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
event++;
|
|
event++;
|
|
|
|
|
|
if (!(flags & MNT_DETACH))
|
|
if (!(flags & MNT_DETACH))
|
|
@@ -1171,7 +1172,7 @@ static int do_umount(struct mount *mnt, int flags)
|
|
umount_tree(mnt, 1, &umount_list);
|
|
umount_tree(mnt, 1, &umount_list);
|
|
retval = 0;
|
|
retval = 0;
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
release_mounts(&umount_list);
|
|
release_mounts(&umount_list);
|
|
return retval;
|
|
return retval;
|
|
@@ -1286,19 +1287,19 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
|
|
q = clone_mnt(p, p->mnt.mnt_root, flag);
|
|
q = clone_mnt(p, p->mnt.mnt_root, flag);
|
|
if (!q)
|
|
if (!q)
|
|
goto Enomem;
|
|
goto Enomem;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_add_tail(&q->mnt_list, &res->mnt_list);
|
|
list_add_tail(&q->mnt_list, &res->mnt_list);
|
|
attach_mnt(q, &path);
|
|
attach_mnt(q, &path);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
return res;
|
|
Enomem:
|
|
Enomem:
|
|
if (res) {
|
|
if (res) {
|
|
LIST_HEAD(umount_list);
|
|
LIST_HEAD(umount_list);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
umount_tree(res, 0, &umount_list);
|
|
umount_tree(res, 0, &umount_list);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
release_mounts(&umount_list);
|
|
release_mounts(&umount_list);
|
|
}
|
|
}
|
|
return NULL;
|
|
return NULL;
|
|
@@ -1318,9 +1319,9 @@ void drop_collected_mounts(struct vfsmount *mnt)
|
|
{
|
|
{
|
|
LIST_HEAD(umount_list);
|
|
LIST_HEAD(umount_list);
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
umount_tree(real_mount(mnt), 0, &umount_list);
|
|
umount_tree(real_mount(mnt), 0, &umount_list);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
release_mounts(&umount_list);
|
|
release_mounts(&umount_list);
|
|
}
|
|
}
|
|
@@ -1448,7 +1449,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
|
|
if (err)
|
|
if (err)
|
|
goto out_cleanup_ids;
|
|
goto out_cleanup_ids;
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
|
|
|
|
if (IS_MNT_SHARED(dest_mnt)) {
|
|
if (IS_MNT_SHARED(dest_mnt)) {
|
|
for (p = source_mnt; p; p = next_mnt(p, source_mnt))
|
|
for (p = source_mnt; p; p = next_mnt(p, source_mnt))
|
|
@@ -1467,7 +1468,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
|
|
list_del_init(&child->mnt_hash);
|
|
list_del_init(&child->mnt_hash);
|
|
commit_tree(child);
|
|
commit_tree(child);
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -1565,10 +1566,10 @@ static int do_change_type(struct path *path, int flag)
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
}
|
|
}
|
|
|
|
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))
|
|
for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))
|
|
change_mnt_propagation(m, type);
|
|
change_mnt_propagation(m, type);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
out_unlock:
|
|
out_unlock:
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
@@ -1617,9 +1618,9 @@ static int do_loopback(struct path *path, char *old_name,
|
|
|
|
|
|
err = graft_tree(mnt, path);
|
|
err = graft_tree(mnt, path);
|
|
if (err) {
|
|
if (err) {
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
umount_tree(mnt, 0, &umount_list);
|
|
umount_tree(mnt, 0, &umount_list);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
out2:
|
|
out2:
|
|
unlock_mount(path);
|
|
unlock_mount(path);
|
|
@@ -1677,16 +1678,16 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
|
|
else
|
|
else
|
|
err = do_remount_sb(sb, flags, data, 0);
|
|
err = do_remount_sb(sb, flags, data, 0);
|
|
if (!err) {
|
|
if (!err) {
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK;
|
|
mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK;
|
|
mnt->mnt.mnt_flags = mnt_flags;
|
|
mnt->mnt.mnt_flags = mnt_flags;
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
up_write(&sb->s_umount);
|
|
up_write(&sb->s_umount);
|
|
if (!err) {
|
|
if (!err) {
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
}
|
|
}
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -1893,9 +1894,9 @@ fail:
|
|
/* remove m from any expiration list it may be on */
|
|
/* remove m from any expiration list it may be on */
|
|
if (!list_empty(&mnt->mnt_expire)) {
|
|
if (!list_empty(&mnt->mnt_expire)) {
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_del_init(&mnt->mnt_expire);
|
|
list_del_init(&mnt->mnt_expire);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
}
|
|
}
|
|
mntput(m);
|
|
mntput(m);
|
|
@@ -1911,11 +1912,11 @@ fail:
|
|
void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
|
|
void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
|
|
{
|
|
{
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
|
|
|
|
list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
|
|
list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
|
|
|
|
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mnt_set_expiry);
|
|
EXPORT_SYMBOL(mnt_set_expiry);
|
|
@@ -1935,7 +1936,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
|
|
return;
|
|
return;
|
|
|
|
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
|
|
|
|
/* extract from the expiration list every vfsmount that matches the
|
|
/* extract from the expiration list every vfsmount that matches the
|
|
* following criteria:
|
|
* following criteria:
|
|
@@ -1954,7 +1955,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
touch_mnt_namespace(mnt->mnt_ns);
|
|
umount_tree(mnt, 1, &umounts);
|
|
umount_tree(mnt, 1, &umounts);
|
|
}
|
|
}
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
|
|
|
|
release_mounts(&umounts);
|
|
release_mounts(&umounts);
|
|
@@ -2218,9 +2219,9 @@ void mnt_make_shortterm(struct vfsmount *m)
|
|
struct mount *mnt = real_mount(m);
|
|
struct mount *mnt = real_mount(m);
|
|
if (atomic_add_unless(&mnt->mnt_longterm, -1, 1))
|
|
if (atomic_add_unless(&mnt->mnt_longterm, -1, 1))
|
|
return;
|
|
return;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
atomic_dec(&mnt->mnt_longterm);
|
|
atomic_dec(&mnt->mnt_longterm);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2250,9 +2251,9 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
|
|
return ERR_PTR(-ENOMEM);
|
|
return ERR_PTR(-ENOMEM);
|
|
}
|
|
}
|
|
new_ns->root = new;
|
|
new_ns->root = new;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
list_add_tail(&new_ns->list, &new->mnt_list);
|
|
list_add_tail(&new_ns->list, &new->mnt_list);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Second pass: switch the tsk->fs->* elements and mark new vfsmounts
|
|
* 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,
|
|
int path_is_under(struct path *path1, struct path *path2)
|
|
int path_is_under(struct path *path1, struct path *path2)
|
|
{
|
|
{
|
|
int res;
|
|
int res;
|
|
- br_read_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_lock(&vfsmount_lock);
|
|
res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
|
|
res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
|
|
- br_read_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_read_unlock(&vfsmount_lock);
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(path_is_under);
|
|
EXPORT_SYMBOL(path_is_under);
|
|
@@ -2505,7 +2506,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
|
|
/* make sure we can reach put_old from new_root */
|
|
/* make sure we can reach put_old from new_root */
|
|
if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new))
|
|
if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new))
|
|
goto out4;
|
|
goto out4;
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
detach_mnt(new_mnt, &parent_path);
|
|
detach_mnt(new_mnt, &parent_path);
|
|
detach_mnt(root_mnt, &root_parent);
|
|
detach_mnt(root_mnt, &root_parent);
|
|
/* mount old root on put_old */
|
|
/* mount old root on put_old */
|
|
@@ -2513,7 +2514,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
|
|
/* mount new_root on / */
|
|
/* mount new_root on / */
|
|
attach_mnt(new_mnt, &root_parent);
|
|
attach_mnt(new_mnt, &root_parent);
|
|
touch_mnt_namespace(current->nsproxy->mnt_ns);
|
|
touch_mnt_namespace(current->nsproxy->mnt_ns);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
chroot_fs_refs(&root, &new);
|
|
chroot_fs_refs(&root, &new);
|
|
error = 0;
|
|
error = 0;
|
|
out4:
|
|
out4:
|
|
@@ -2576,7 +2577,7 @@ void __init mnt_init(void)
|
|
for (u = 0; u < HASH_SIZE; u++)
|
|
for (u = 0; u < HASH_SIZE; u++)
|
|
INIT_LIST_HEAD(&mount_hashtable[u]);
|
|
INIT_LIST_HEAD(&mount_hashtable[u]);
|
|
|
|
|
|
- br_lock_init(vfsmount_lock);
|
|
|
|
|
|
+ br_lock_init(&vfsmount_lock);
|
|
|
|
|
|
err = sysfs_init();
|
|
err = sysfs_init();
|
|
if (err)
|
|
if (err)
|
|
@@ -2596,9 +2597,9 @@ void put_mnt_ns(struct mnt_namespace *ns)
|
|
if (!atomic_dec_and_test(&ns->count))
|
|
if (!atomic_dec_and_test(&ns->count))
|
|
return;
|
|
return;
|
|
down_write(&namespace_sem);
|
|
down_write(&namespace_sem);
|
|
- br_write_lock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_lock(&vfsmount_lock);
|
|
umount_tree(ns->root, 0, &umount_list);
|
|
umount_tree(ns->root, 0, &umount_list);
|
|
- br_write_unlock(vfsmount_lock);
|
|
|
|
|
|
+ br_write_unlock(&vfsmount_lock);
|
|
up_write(&namespace_sem);
|
|
up_write(&namespace_sem);
|
|
release_mounts(&umount_list);
|
|
release_mounts(&umount_list);
|
|
kfree(ns);
|
|
kfree(ns);
|