Re: [PATCH v5 22/42] open: handle idmapped mounts in do_truncate()

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

 



On Tue, Jan 12, 2021 at 11:01:04PM +0100, Christian Brauner wrote:
> @@ -930,8 +932,12 @@ void dump_truncate(struct coredump_params *cprm)
>  
>  	if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
>  		offset = file->f_op->llseek(file, 0, SEEK_CUR);
> -		if (i_size_read(file->f_mapping->host) < offset)
> -			do_truncate(file->f_path.dentry, offset, 0, file);
> +		if (i_size_read(file->f_mapping->host) < offset) {
> +			struct user_namespace *mnt_userns;
> +
> +			mnt_userns = file_user_ns(file);
> +			do_truncate(mnt_userns, file->f_path.dentry, offset, 0, file);
> +		}

I think we can skip the local variable here.  In fact for all callers
of do_truncate except vfs_truncate a little file_truncate helper that
takes a struct file would help readability a lot.



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux