Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: truncate pages from clone ioctl target range

We need to truncate page cache pages for the clone ioctl target range or
else we'll confuse ourselves to no end. If the old data was cached, we
used to still see it (until remount). If the page was partially updated
we used to get a mix of old and new data.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>

authored by

Sage Weil and committed by
Chris Mason
f81c9cdc 0e588859

+4
+4
fs/btrfs/ioctl.c
··· 2244 2244 btrfs_wait_ordered_range(src, off, len); 2245 2245 } 2246 2246 2247 + /* truncate page cache pages from target inode range */ 2248 + truncate_inode_pages_range(&inode->i_data, off, 2249 + ALIGN(off + len, PAGE_CACHE_SIZE) - 1); 2250 + 2247 2251 /* clone data */ 2248 2252 key.objectid = btrfs_ino(src); 2249 2253 key.type = BTRFS_EXTENT_DATA_KEY;