Skip to content

Commit 26e726a

Browse files
ChengyuSongmasoncl
authored andcommitted
btrfs: incorrect handling for fiemap_fill_next_extent return
fiemap_fill_next_extent returns 0 on success, -errno on error, 1 if this was the last extent that will fit in user array. If 1 is returned, the return value may eventually returned to user space, which should not happen, according to manpage of ioctl. Signed-off-by: Chengyu Song <[email protected]> Reviewed-by: David Sterba <[email protected]> Reviewed-by: Liu Bo <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 3c3b04d commit 26e726a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/extent_io.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4514,8 +4514,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
45144514
}
45154515
ret = fiemap_fill_next_extent(fieinfo, em_start, disko,
45164516
em_len, flags);
4517-
if (ret)
4517+
if (ret) {
4518+
if (ret == 1)
4519+
ret = 0;
45184520
goto out_free;
4521+
}
45194522
}
45204523
out_free:
45214524
free_extent_map(em);

0 commit comments

Comments
 (0)