On Mon 19-01-26 07:22:44, Christoph Hellwig wrote:
> Call into fsverity_file_open from generic_file_open instead of requiring
> the file system to handle it explicitly.
>
> Signed-off-by: Christoph Hellwig <[email protected]>
...
> -int generic_file_open(struct inode * inode, struct file * filp)
> +int generic_file_open(struct inode *inode, struct file *filp)
> {
> if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
> return -EOVERFLOW;
> + if (IS_ENABLED(CONFIG_FS_VERITY) && IS_VERITY(inode)) {
> + if (filp->f_mode & FMODE_WRITE)
> + return -EPERM;
> + return fsverity_file_open(inode, filp);
> + }
Why do you check f_mode here when fsverity_file_open() checks for it as
well?
> -int __fsverity_file_open(struct inode *inode, struct file *filp)
> +/*
> + * When opening a verity file, deny the open if it is for writing.
> Otherwise,
> + * set up the inode's verity info if not already done.
> + *
> + * When combined with fscrypt, this must be called after fscrypt_file_open().
> + * Otherwise, we won't have the key set up to decrypt the verity metadata.
> + */
> +int fsverity_file_open(struct inode *inode, struct file *filp)
> {
> if (filp->f_mode & FMODE_WRITE)
> return -EPERM;
> return ensure_verity_info(inode);
> }
> -EXPORT_SYMBOL_GPL(__fsverity_file_open);
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel