Project

General

Profile

Bug #14827

os/filestore: copy_range may return OK if fail to verify src/dst offset

Added by xie xingguo over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
02/20/2016
Due date:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Associated revisions

Revision 9644df6d (diff)
Added by xie xingguo over 3 years ago

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 <>

History

#1 Updated by Sage Weil over 3 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF