mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
ANDROID: mnt: Add filesystem private data to mount points
This starts to add private data associated directly to mount points. The intent is to give filesystems a sense of where they have come from, as a means of letting a filesystem take different actions based on this information. Bug: 62094374 Bug: 120446149 Bug: 122428178 Change-Id: Ie769d7b3bb2f5972afe05c1bf16cf88c91647ab2 Signed-off-by: Daniel Rosenberg <[email protected]> [astrachan: Folded 89a54ed3bf68 ("ANDROID: mnt: Fix next_descendent") into this patch] [drosen: Folded 138993ea820 ("Android: mnt: Propagate remount correctly") into this patch, integrated fs_context things Now has update_mnt_data instead of needing remount2 Signed-off-by: Alistair Strachan <[email protected]>
This commit is contained in:
parent
4d53a0405c
commit
8e31748d2c
5 changed files with 49 additions and 1 deletions
|
|
@ -203,6 +203,7 @@ static struct mount *alloc_vfsmnt(const char *name)
|
|||
mnt->mnt_count = 1;
|
||||
mnt->mnt_writers = 0;
|
||||
#endif
|
||||
mnt->mnt.data = NULL;
|
||||
|
||||
INIT_HLIST_NODE(&mnt->mnt_hash);
|
||||
INIT_LIST_HEAD(&mnt->mnt_child);
|
||||
|
|
@ -552,6 +553,7 @@ int sb_prepare_remount_readonly(struct super_block *sb)
|
|||
|
||||
static void free_vfsmnt(struct mount *mnt)
|
||||
{
|
||||
kfree(mnt->mnt.data);
|
||||
kfree_const(mnt->mnt_devname);
|
||||
#ifdef CONFIG_SMP
|
||||
free_percpu(mnt->mnt_pcp);
|
||||
|
|
@ -962,6 +964,15 @@ struct vfsmount *vfs_create_mount(struct fs_context *fc)
|
|||
if (!mnt)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
if (fc->fs_type->alloc_mnt_data) {
|
||||
mnt->mnt.data = fc->fs_type->alloc_mnt_data();
|
||||
if (!mnt->mnt.data) {
|
||||
mnt_free_id(mnt);
|
||||
free_vfsmnt(mnt);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
fc->root->d_sb->s_op->update_mnt_data(mnt->mnt.data, fc);
|
||||
}
|
||||
if (fc->sb_flags & SB_KERNMOUNT)
|
||||
mnt->mnt.mnt_flags = MNT_INTERNAL;
|
||||
|
||||
|
|
@ -1045,6 +1056,14 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
|
|||
if (!mnt)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
if (sb->s_op->clone_mnt_data) {
|
||||
mnt->mnt.data = sb->s_op->clone_mnt_data(old->mnt.data);
|
||||
if (!mnt->mnt.data) {
|
||||
err = -ENOMEM;
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
|
||||
mnt->mnt_group_id = 0; /* not a peer of original */
|
||||
else
|
||||
|
|
@ -2531,8 +2550,15 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags,
|
|||
err = -EPERM;
|
||||
if (ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) {
|
||||
err = reconfigure_super(fc);
|
||||
if (!err)
|
||||
if (!err) {
|
||||
sb->s_op->update_mnt_data(mnt->mnt.data, fc);
|
||||
set_mount_attributes(mnt, mnt_flags);
|
||||
namespace_lock();
|
||||
lock_mount_hash();
|
||||
propagate_remount(mnt);
|
||||
unlock_mount_hash();
|
||||
namespace_unlock();
|
||||
}
|
||||
}
|
||||
up_write(&sb->s_umount);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue