Re: [RFC PATCH 4/4] f2fs: Handle casefolding with Encryption (INCOMPLETE)

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

 



On Thu, May 07, 2020 at 12:59:05AM -0700, Eric Biggers wrote:
> -static void init_dent_inode(const struct f2fs_filename *fname,
> +static void init_dent_inode(struct inode *dir, struct inode *inode,
> +			    const struct f2fs_filename *fname,
>  			    struct page *ipage)
>  {
>  	struct f2fs_inode *ri;
>  
> +	if (!fname) /* tmpfile case? */
> +		return;
> +
>  	f2fs_wait_on_page_writeback(ipage, NODE, true, true);
>  
>  	/* copy name info. to this inode page */
>  	ri = F2FS_INODE(ipage);
>  	ri->i_namelen = cpu_to_le32(fname->disk_name.len);
>  	memcpy(ri->i_name, fname->disk_name.name, fname->disk_name.len);
> +	if (IS_ENCRYPTED(dir)) {
> +		file_set_enc_name(inode);
> +		/*
> +		 * Roll-forward recovery doesn't have encryption keys available,
> +		 * so it can't compute the dirhash for encrypted+casefolded
> +		 * filenames.  Append it to i_name if possible.  Else, disable
> +		 * roll-forward recovery of the dentry (i.e., make fsync'ing the
> +		 * file force a checkpoint) by setting LOST_PINO.
> +		 */
> +		if (IS_CASEFOLDED(dir)) {
> +			if (fname->disk_name.len + sizeof(f2fs_hash_t) <=
> +			    F2FS_NAME_LEN)
> +				put_unaligned(fname->hash,
> +					&ri->i_name[fname->disk_name.len]);

Jaegeuk pointed out that we need a cast to 'f2fs_hash_t *' here.

- Eric



[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