aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2011-09-18 10:20:46 -0400
committerChris Mason <chris.mason@oracle.com>2011-09-18 10:20:46 -0400
commit71ef07861080418d125dcf454af41baafa409a2c (patch)
tree9f2c706625a67a5164f774805eb8aaa32ea2410b /fs/btrfs
parent3765fefaee2da83f10829fa64a74e6b7360350cb (diff)
Btrfs: fix pages truncation in btrfs_ioctl_clone()
It's a bug in commit f81c9cdc567cd3160ff9e64868d9a1a7ee226480 (Btrfs: truncate pages from clone ioctl target range) We should pass the dest range to the truncate function, but not the src range. Also move the function before locking extent state. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 63b4de1626d2..8bfb514b26c9 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2234,6 +2234,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
2234 goto out_unlock; 2234 goto out_unlock;
2235 } 2235 }
2236 2236
2237 /* truncate page cache pages from target inode range */
2238 truncate_inode_pages_range(&inode->i_data, destoff,
2239 PAGE_CACHE_ALIGN(destoff + len) - 1);
2240
2237 /* do any pending delalloc/csum calc on src, one way or 2241 /* do any pending delalloc/csum calc on src, one way or
2238 another, and lock file content */ 2242 another, and lock file content */
2239 while (1) { 2243 while (1) {
@@ -2250,10 +2254,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
2250 btrfs_wait_ordered_range(src, off, len); 2254 btrfs_wait_ordered_range(src, off, len);
2251 } 2255 }
2252 2256
2253 /* truncate page cache pages from target inode range */
2254 truncate_inode_pages_range(&inode->i_data, off,
2255 ALIGN(off + len, PAGE_CACHE_SIZE) - 1);
2256
2257 /* clone data */ 2257 /* clone data */
2258 key.objectid = btrfs_ino(src); 2258 key.objectid = btrfs_ino(src);
2259 key.type = BTRFS_EXTENT_DATA_KEY; 2259 key.type = BTRFS_EXTENT_DATA_KEY;