]> Git Repo - linux.git/commitdiff
Btrfs: truncate pages from clone ioctl target range
authorSage Weil <[email protected]>
Wed, 10 Aug 2011 18:04:04 +0000 (18:04 +0000)
committerChris Mason <[email protected]>
Wed, 17 Aug 2011 01:09:31 +0000 (21:09 -0400)
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 <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
fs/btrfs/ioctl.c

index 2bb08862a4f6a7af63c90391f282abc9a8dc312c..b3d249d6eba7a4cf149bbda3028477b98a16b2c1 100644 (file)
@@ -2244,6 +2244,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                btrfs_wait_ordered_range(src, off, len);
        }
 
+       /* truncate page cache pages from target inode range */
+       truncate_inode_pages_range(&inode->i_data, off,
+                                  ALIGN(off + len, PAGE_CACHE_SIZE) - 1);
+
        /* clone data */
        key.objectid = btrfs_ino(src);
        key.type = BTRFS_EXTENT_DATA_KEY;
This page took 0.061834 seconds and 4 git commands to generate.