From 13c7b9878dc3a7b60c714b3c3d29eb5b825f7115 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 7 Oct 2013 14:51:11 -0700 Subject: osdc/Objecter: consistently return error in prval In several error paths we were not copying the error code to prval. Signed-off-by: Sage Weil --- src/osdc/Objecter.h | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 1196633276d..709dc814fe7 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -212,10 +212,11 @@ struct ObjectOperation { if (ptime) *ptime = mtime.sec(); } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } } + if (prval) + *prval = r; } }; void stat(uint64_t *psize, utime_t *pmtime, int *prval) { @@ -262,10 +263,11 @@ struct ObjectOperation { ::decode(*extents, iter); ::decode(*data_bl, iter); } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } } + if (prval) + *prval = r; } }; void sparse_read(uint64_t off, uint64_t len, std::map *m, @@ -335,10 +337,11 @@ struct ObjectOperation { ::decode(*pattrs, p); } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } } + if (prval) + *prval = r; } }; struct C_ObjectOperation_decodekeys : public Context { @@ -355,10 +358,11 @@ struct ObjectOperation { ::decode(*pattrs, p); } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } - } + } + if (prval) + *prval = r; } }; struct C_ObjectOperation_decodewatchers : public Context { @@ -389,10 +393,11 @@ struct ObjectOperation { *prval = 0; } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } - } + } + if (prval) + *prval = r; } }; struct C_ObjectOperation_decodesnaps : public Context { @@ -424,14 +429,14 @@ struct ObjectOperation { } psnaps->seq = resp.seq; } - if (prval) - *prval = 0; + r = 0; } catch (buffer::error& e) { - if (prval) - *prval = -EIO; + r = -EIO; } } + if (prval) + *prval = r; } }; void getxattrs(std::map *pattrs, int *prval) { @@ -588,7 +593,7 @@ struct ObjectOperation { out_data(d), out_omap(o), prval(r) {} void finish(int r) { if (r < 0) - return; + goto out; try { bufferlist::iterator p = bl.begin(); uint64_t size; @@ -619,6 +624,7 @@ struct ObjectOperation { } catch (buffer::error& e) { r = -EIO; } + out: if (prval) *prval = r; } @@ -656,7 +662,7 @@ struct ObjectOperation { : pisdirty(p), prval(r) {} void finish(int r) { if (r < 0) - return; + goto out; try { bufferlist::iterator p = bl.begin(); bool isdirty; @@ -666,6 +672,7 @@ struct ObjectOperation { } catch (buffer::error& e) { r = -EIO; } + out: if (prval) *prval = r; } -- cgit v1.2.1