]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
os/filestore: fix result code if sanity check failed during copy_range 7711/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 20 Feb 2016 07:33:27 +0000 (15:33 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 20 Feb 2016 08:03:52 +0000 (16:03 +0800)
commit9644df6ddd892d1aad241f8e981d76b49c2182a8
tree02d24852b8f8f76f06b77c7926ff016acf6b553b
parent877eae85ce7630fa05cc16f5f71be40e08607a5c
os/filestore: fix result code if sanity check failed during copy_range

According to Linux Man Page, the lseek() system call returns -1 and
sets errno only if it indeed encouters some error.
The problem here is if lseek64() returns a positive answer, which
is not strictly equal to the expected answer however, then errno
may not be set and we return success instead, which is wrong.

This commit solves the above problem by checking against the returned
value of lseek64(), if -1 then we reset result code to errno, otherwise
we reset result code to -EINVAL to indicate that it is sanity check not
passed is the real relevant issue.

One more thing, as _do_copy_range() may return customized error code,
caller shall not redirect result code to errno on failure, which is
also shall be considered as wrong action.

Fixes: #14827
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/filestore/FileStore.cc