Merge tag 'for-4.20-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: "Several fixes to recent release (4.19, fixes tagged for stable) and other fixes" * tag 'for-4.20-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: Btrfs: fix missing delayed iputs on unmount Btrfs: fix data corruption due to cloning of eof block Btrfs: fix infinite loop on inode eviction after deduplication of eof block Btrfs: fix deadlock on tree root leaf when finding free extent btrfs: avoid link error with CONFIG_NO_AUTO_INLINE btrfs: tree-checker: Fix misleading group system information Btrfs: fix missing data checksums after a ranged fsync (msync) btrfs: fix pinned underflow after transaction aborted Btrfs: fix cur_offset in the error case for nocow
This commit is contained in:
@@ -3488,6 +3488,8 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen,
|
||||
const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize;
|
||||
|
||||
len = round_down(i_size_read(src), sz) - loff;
|
||||
if (len == 0)
|
||||
return 0;
|
||||
olen = len;
|
||||
}
|
||||
}
|
||||
@@ -4257,9 +4259,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
|
||||
goto out_unlock;
|
||||
if (len == 0)
|
||||
olen = len = src->i_size - off;
|
||||
/* if we extend to eof, continue to block boundary */
|
||||
if (off + len == src->i_size)
|
||||
/*
|
||||
* If we extend to eof, continue to block boundary if and only if the
|
||||
* destination end offset matches the destination file's size, otherwise
|
||||
* we would be corrupting data by placing the eof block into the middle
|
||||
* of a file.
|
||||
*/
|
||||
if (off + len == src->i_size) {
|
||||
if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size)
|
||||
goto out_unlock;
|
||||
len = ALIGN(src->i_size, bs) - off;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
ret = 0;
|
||||
|
Reference in New Issue
Block a user