Re: [PATCH 3/7] udf: Convert udf_expand_file_adinicb() to use a folio

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

 



On Wed 17-04-24 16:04:09, Matthew Wilcox (Oracle) wrote:
> Use the folio APIs throughout this function.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

Looks good.

>  	up_write(&iinfo->i_data_sem);
>  	err = filemap_fdatawrite(inode->i_mapping);
>  	if (err) {
>  		/* Restore everything back so that we don't lose data... */
> -		lock_page(page);
> +		folio_lock(folio);
>  		down_write(&iinfo->i_data_sem);
> -		memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr,
> -			       inode->i_size);
> -		unlock_page(page);
> +		memcpy_from_folio(iinfo->i_data + iinfo->i_lenEAttr,
> +				folio, 0, inode->i_size);
> +		folio_unlock(folio);

So this actually silently fixes a bug on the error recovery path where we
could be loosing old data in case of ENOSPC. I'll add:

Fixes: 1eeceaec794e ("udf: Convert udf_expand_file_adinicb() to avoid kmap_atomic()")

and some commentary on commit.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux