aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-08-10 14:04:04 -0400
committerChris Mason <chris.mason@oracle.com>2011-08-16 21:09:31 -0400
commitf81c9cdc567cd3160ff9e64868d9a1a7ee226480 (patch)
treed4812f9328ea0f5945c42a6b694bdcdb7bdbd707 /fs/btrfs
parent0e588859618be54ec100373f1b86296271ce5307 (diff)
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 2bb08862a4f6..b3d249d6eba7 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2244,6 +2244,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
2244 btrfs_wait_ordered_range(src, off, len); 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 /* clone data */ 2251 /* clone data */
2248 key.objectid = btrfs_ino(src); 2252 key.objectid = btrfs_ino(src);
2249 key.type = BTRFS_EXTENT_DATA_KEY; 2253 key.type = BTRFS_EXTENT_DATA_KEY;