lkml.org 
[lkml]   [2015]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ovl: Prevent rw remount when it should be ro mount
On 2015/1/3 1:26, Seunghun Lee wrote:
> Overlayfs should be mounted read-only when upper-fs is read-only or nonexistent.
> But now it can be remounted read-write and this can cause kernel panic.
> So we should prevent read-write remount when the above situation happens.
>
> Signed-off-by: Seunghun Lee <waydi1@gmail.com>
> ---
> fs/overlayfs/super.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 84f3144..8944651 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)
> return 0;
> }
>
> +static int ovl_remount(struct super_block *sb, int *flags, char *data)
> +{
> + struct ovl_fs *ufs = sb->s_fs_info;
> +
> + if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
> + *flags |= MS_RDONLY;
> +
> + return 0;
> +}
> +
> static const struct super_operations ovl_super_operations = {
> .put_super = ovl_put_super,
> .statfs = ovl_statfs,
> .show_options = ovl_show_options,
> + .remount_fs = ovl_remount,
> };
>
> enum {
>

I think this exporting of .remount_fs may allow people in userspace
have the ability to remount a filesystem with a new set of mounting
options. Your new adding function do nothing with the passing in
parameters.

I'm not sure if it could be competent for remount case.

Add Cc linux-unionfs.



\
 
 \ /
  Last update: 2015-01-04 04:21    [W:0.102 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site