ANDROID: vfs: Allow filesystems to access their private mount data

Now we pass the vfsmount when mounting and remounting.
This allows the filesystem to actually set up the mount
specific data, although we can't quite do anything with
it yet. show_options is expanded to include data that
lives with the mount.

To avoid changing existing filesystems, these have
been added as new vfs functions.

Change-Id: If80670bfad9f287abb8ac22457e1b034c9697097
Signed-off-by: Daniel Rosenberg <drosen@google.com>
This commit is contained in:
Daniel Rosenberg
2016-10-26 15:58:22 -07:00
committed by Dmitry Shmidt
parent 1aaf05b350
commit 29f888e730
5 changed files with 38 additions and 10 deletions
+23 -5
View File
@@ -750,7 +750,8 @@ rescan:
}
/**
* do_remount_sb - asks filesystem to change mount options.
* do_remount_sb2 - asks filesystem to change mount options.
* @mnt: mount we are looking at
* @sb: superblock in question
* @flags: numeric part of options
* @data: the rest of options
@@ -758,7 +759,7 @@ rescan:
*
* Alters the mount options of a mounted file system.
*/
int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
int do_remount_sb2(struct vfsmount *mnt, struct super_block *sb, int flags, void *data, int force)
{
int retval;
int remount_ro;
@@ -800,7 +801,16 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
}
}
if (sb->s_op->remount_fs) {
if (mnt && sb->s_op->remount_fs2) {
retval = sb->s_op->remount_fs2(mnt, sb, &flags, data);
if (retval) {
if (!force)
goto cancel_readonly;
/* If forced remount, go ahead despite any errors */
WARN(1, "forced remount of a %s fs returned %i\n",
sb->s_type->name, retval);
}
} else if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) {
if (!force)
@@ -832,6 +842,11 @@ cancel_readonly:
return retval;
}
int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
{
return do_remount_sb2(NULL, sb, flags, data, force);
}
static void do_emergency_remount(struct work_struct *work)
{
struct super_block *sb, *p = NULL;
@@ -1157,7 +1172,7 @@ struct dentry *mount_single(struct file_system_type *fs_type,
EXPORT_SYMBOL(mount_single);
struct dentry *
mount_fs(struct file_system_type *type, int flags, const char *name, void *data)
mount_fs(struct file_system_type *type, int flags, const char *name, struct vfsmount *mnt, void *data)
{
struct dentry *root;
struct super_block *sb;
@@ -1174,7 +1189,10 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data)
goto out_free_secdata;
}
root = type->mount(type, flags, name, data);
if (type->mount2)
root = type->mount2(mnt, type, flags, name, data);
else
root = type->mount(type, flags, name, data);
if (IS_ERR(root)) {
error = PTR_ERR(root);
goto out_free_secdata;