Skip to content

Commit d525e8a

Browse files
Li Zefanchrismason-xx
Li Zefan
authored andcommitted
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 <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent d72c084 commit d525e8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/btrfs/ioctl.c

+6
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
22282228
!IS_ALIGNED(destoff, bs))
22292229
goto out_unlock;
22302230

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+
22312237
/* do any pending delalloc/csum calc on src, one way or
22322238
another, and lock file content */
22332239
while (1) {

0 commit comments

Comments
 (0)