diff options
author | Chengyu Song <csong84@gatech.edu> | 2015-03-24 18:12:56 -0400 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-06-23 14:55:14 +0200 |
commit | 9cb9cfc9f2a6f6c3177744b50f5514190f0cca96 (patch) | |
tree | 0ba662664f68b47fc5e414b8eb6c08f83b69a45e /fs | |
parent | 27ea4a8d98cb59b5ee41e36e1165117a63d70555 (diff) | |
download | lwn-9cb9cfc9f2a6f6c3177744b50f5514190f0cca96.tar.gz lwn-9cb9cfc9f2a6f6c3177744b50f5514190f0cca96.zip |
btrfs: incorrect handling for fiemap_fill_next_extent return
commit 26e726afe01c1c82072cf23a5ed89ce25f39d9f2 upstream.
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 <csong84@gatech.edu>
Reviewed-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent_io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 7015d9079bd1..855f6668cb8e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4228,8 +4228,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, } ret = fiemap_fill_next_extent(fieinfo, em_start, disko, em_len, flags); - if (ret) + if (ret) { + if (ret == 1) + ret = 0; goto out_free; + } } out_free: free_extent_map(em); |