Re: [PATCH v2 09/20] btrfs: setup fscrypt_names from dentrys using helper

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

 



On Mon, Sep 05, 2022 at 08:35:24PM -0400, Sweet Tea Dorminy wrote:
> Most places that we create fscrypt_names, we are doing so from a dentry.
> Fscrypt provides a helper for this common pattern:
> fscrypt_setup_filename() initializes a filename to search for from a
> dentry, performing encryption of the plaintext if it can and should be
> done. This converts each setup of a fscrypt_name from a dentry to use
> this helper; at present, since there are no encrypted directories,
> nothing goes down the filename encryption paths.
> 
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@xxxxxxxxxx>

<snip>

> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 40cfaa9feff3..53195cfe6a3d 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -7443,13 +7443,13 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans,
>  	if (old_dir && old_dir->logged_trans == trans->transid) {
>  		struct btrfs_root *log = old_dir->root->log_root;
>  		struct btrfs_path *path;
> -		struct fscrypt_name fname = {
> -			.disk_name = FSTR_INIT((char *) old_dentry->d_name.name,
> -					       old_dentry->d_name.len)
> -		};
> -
> +		struct fscrypt_name fname;
>  		ASSERT(old_dir_index >= BTRFS_DIR_START_INDEX);
>  
> +		ret = fscrypt_setup_filename(&old_dir->vfs_inode,
> +					     &old_dentry->d_name, 0, &fname);
> +		if (ret)
> +			goto out;
>  		/*
>  		 * We have two inodes to update in the log, the old directory and
>  		 * the inode that got renamed, so we must pin the log to prevent
> @@ -7469,6 +7469,7 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans,

There's another error case just above this that you missed.  Thanks,

Josef



[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux