Re: [PATCH 1/3] ovl: force read-only sb on failure to create index dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 13, 2020 at 05:19:43PM +0300, Amir Goldstein wrote:
> With index feature enabled, on failure to create index dir, overlay
> is being mounted read-only.  However, we do not forbid user to remount
> overlay read-write.  Fix that by setting ofs->workdir to NULL, which
> prevents remount read-write.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

This patch does not apply for me. What branch you have generated it
against. I am using 5.8-rc4.

Vivek

> ---
>  fs/overlayfs/super.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 4b7cb2d98203..41d7fe2b8129 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -1374,12 +1374,13 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ofs,
>  		goto out;
>  	}
>  
> +	/* index dir will act also as workdir */
> +	iput(ofs->workdir_trap);
> +	ofs->workdir_trap = NULL;
> +	dput(ofs->workdir);
> +	ofs->workdir = NULL;
>  	ofs->indexdir = ovl_workdir_create(ofs, OVL_INDEXDIR_NAME, true);
>  	if (ofs->indexdir) {
> -		/* index dir will act also as workdir */
> -		iput(ofs->workdir_trap);
> -		ofs->workdir_trap = NULL;
> -		dput(ofs->workdir);
>  		ofs->workdir = dget(ofs->indexdir);
>  
>  		err = ovl_setup_trap(sb, ofs->indexdir, &ofs->indexdir_trap,
> @@ -1884,7 +1885,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
>  	if (!ovl_upper_mnt(ofs))
>  		sb->s_flags |= SB_RDONLY;
>  
> -	if (!(ovl_force_readonly(ofs)) && ofs->config.index) {
> +	if (!ovl_force_readonly(ofs) && ofs->config.index) {
>  		err = ovl_get_indexdir(sb, ofs, oe, &upperpath);
>  		if (err)
>  			goto out_free_oe;
> -- 
> 2.17.1
> 




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux