]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix unexpected return value of fiemap
authorLiu Bo <bo.li.liu@oracle.com>
Wed, 18 May 2016 00:21:48 +0000 (17:21 -0700)
committerDavid Sterba <dsterba@suse.com>
Wed, 25 May 2016 17:53:54 +0000 (19:53 +0200)
commit1f7c8f6c12fc3912a155aa5fb6230b4ac62098b4
treefa0bf2fb3cb07b89b049542e70ad523d6cad67f5
parentcd38554892c3fb46b57cf0e147840a85c6ec11fe
Btrfs: fix unexpected return value of fiemap

btrfs's fiemap is supposed to return 0 on success and return < 0 on
error. however, ret becomes 1 after looking up the last file extent:

  btrfs_lookup_file_extent ->
    btrfs_search_slot(..., ins_len=0, cow=0)

and if the offset is beyond EOF, we'll get 'path' pointed to the place
of potentail insertion, and ret == 1.

This may confuse applications using ioctl(FIEL_IOC_FIEMAP).

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c