diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-09-11 10:52:25 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-09-11 10:52:25 -0400 |
commit | d525e8ab022cb000e6e31a515ba8c3cf0d9c6130 (patch) | |
tree | afaa93134ca050e1169ed8fe68442b4522d9112e | |
parent | d72c0842ff0e71342857723bb65f35b71f57b264 (diff) |
Btrfs: add dummy extent if dst offset excceeds file end in
You can see there's no file extent with range [0, 4096]. Check this by
btrfsck:
# btrfsck /dev/sda7
root 5 inode 258 errors 100
...
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 028a4b8c12cd..63b4de1626d2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2228,6 +2228,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2228 | !IS_ALIGNED(destoff, bs)) | 2228 | !IS_ALIGNED(destoff, bs)) |
2229 | goto out_unlock; | 2229 | goto out_unlock; |
2230 | 2230 | ||
2231 | if (destoff > inode->i_size) { | ||
2232 | ret = btrfs_cont_expand(inode, inode->i_size, destoff); | ||
2233 | if (ret) | ||
2234 | goto out_unlock; | ||
2235 | } | ||
2236 | |||
2231 | /* do any pending delalloc/csum calc on src, one way or | 2237 | /* do any pending delalloc/csum calc on src, one way or |
2232 | another, and lock file content */ | 2238 | another, and lock file content */ |
2233 | while (1) { | 2239 | while (1) { |