Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osdc: self-managed snapshot helper should catch decode exception #21804

Merged
merged 2 commits into from May 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/mon/OSDMonitor.cc
Expand Up @@ -11713,15 +11713,19 @@ bool OSDMonitor::preprocess_pool_op(MonOpRequestRef op)
if (m->op == POOL_OP_CREATE)
return preprocess_pool_op_create(op);

if (!osdmap.get_pg_pool(m->pool)) {
const pg_pool_t *p = osdmap.get_pg_pool(m->pool);
if (p == nullptr) {
dout(10) << "attempt to operate on non-existent pool id " << m->pool << dendl;
_pool_op_reply(op, 0, osdmap.get_epoch());
if (m->op == POOL_OP_DELETE) {
_pool_op_reply(op, 0, osdmap.get_epoch());
} else {
_pool_op_reply(op, -ENOENT, osdmap.get_epoch());
}
return true;
}

// check if the snap and snapname exist
bool snap_exists = false;
const pg_pool_t *p = osdmap.get_pg_pool(m->pool);
if (p->snap_exists(m->name.c_str()))
snap_exists = true;

Expand Down
8 changes: 6 additions & 2 deletions src/osdc/Objecter.cc
Expand Up @@ -3865,8 +3865,12 @@ struct C_SelfmanagedSnap : public Context {
C_SelfmanagedSnap(snapid_t *ps, Context *f) : psnapid(ps), fin(f) {}
void finish(int r) override {
if (r == 0) {
bufferlist::iterator p = bl.begin();
decode(*psnapid, p);
try {
bufferlist::iterator p = bl.begin();
decode(*psnapid, p);
} catch (buffer::error&) {
r = -EIO;
}
}
fin->complete(r);
}
Expand Down