]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
osd/PrimaryLogPG.cc: reassign size only when object size > truncate_size 24581/head
authorNeha Ojha <nojha@redhat.com>
Tue, 9 Oct 2018 22:57:15 +0000 (15:57 -0700)
committerNathan Cutler <ncutler@suse.com>
Mon, 15 Oct 2018 10:30:04 +0000 (12:30 +0200)
commit1a9ca1869cbe37816e86f8baa50008859b185acf
treeee27cf19ba5c3e8e7d4a6bc9e1e1939a5bb88897
parent1a3a0129707e122acd5b0dab94fed606ab20d510
osd/PrimaryLogPG.cc: reassign size only when object size > truncate_size

Before setting size equal to op.extent.truncate_size, we need to check
if the size of the object is greater than the truncate_size. We do not
need to set size to op.extent.truncate_size, in the case where the size of
the object is less than op.extent.truncate_size.

Without this change, we were always setting size =
op.extent.truncate_size, when (seq < op.extent.truncate_seq) and
(op.extent.offset + op.extent.length > op.extent.truncate_size), were both
true. This ended up in:

1. overestimating the size of the object
2. not considering the correct size of the object, for
   the later checks, which calculate op.extent.length for the read ops
3. causing crashes when trying to read more data than what was present

Fixes: http://tracker.ceph.com/issues/21931
Fixes: http://tracker.ceph.com/issues/22330
Signed-off-by: Neha Ojha <nojha@redhat.com>
(cherry picked from commit 76c57810ee2346c392834206331aacb0faaa5b54)
src/osd/PrimaryLogPG.cc