Merge pull request #18400 from dillaman/wip-21844

osdc/Objecter: skip sparse-read result decode if bufferlist is empty

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-10-21 12:46:57 -05:00 committed by GitHub
commit 7c387fd04a

View File

@ -335,13 +335,20 @@ struct ObjectOperation {
void finish(int r) override {
bufferlist::iterator iter = bl.begin();
if (r >= 0) {
try {
::decode(*extents, iter);
::decode(*data_bl, iter);
} catch (buffer::error& e) {
if (prval)
*prval = -EIO;
}
// NOTE: it's possible the sub-op has not been executed but the result
// code remains zeroed. Avoid the costly exception handling on a
// potential IO path.
if (bl.length() > 0) {
try {
::decode(*extents, iter);
::decode(*data_bl, iter);
} catch (buffer::error& e) {
if (prval)
*prval = -EIO;
}
} else if (prval) {
*prval = -EIO;
}
}
}
};