Skip to content

Commit

Permalink
Merge pull request #50016 from max-licc/nobjects_begin_crash
Browse files Browse the repository at this point in the history
rgw: catches nobjects_begin() exceptions

Reviewed-by: Casey Bodley <[email protected]>
  • Loading branch information
ivancich authored Feb 17, 2023
2 parents e556024 + 63c7d2a commit e344ad1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
19 changes: 15 additions & 4 deletions src/rgw/driver/rados/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1422,10 +1422,21 @@ int RGWRados::log_list_init(const DoutPrefixProvider *dpp, const string& prefix,
delete state;
return r;
}
state->prefix = prefix;
state->obit = state->io_ctx.nobjects_begin();
*handle = (RGWAccessHandle)state;
return 0;
try {
state->prefix = prefix;
state->obit = state->io_ctx.nobjects_begin();
*handle = (RGWAccessHandle)state;
return 0;
} catch (const std::system_error& e) {
r = -e.code().value();
ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what()
<< ", returning " << r << dendl;
return r;
} catch (const std::exception& e) {
ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what()
<< ", returning -5" << dendl;
return -EIO;
}
}

int RGWRados::log_list_next(RGWAccessHandle handle, string *name)
Expand Down
20 changes: 15 additions & 5 deletions src/rgw/services/svc_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,21 @@ int RGWSI_RADOS::Pool::List::init(const DoutPrefixProvider *dpp, const string& m
return -EINVAL;
}

ctx.iter = ctx.ioctx.nobjects_begin(oc);
ctx.filter = filter;
ctx.initialized = true;

return 0;
try {
ctx.iter = ctx.ioctx.nobjects_begin(oc);
ctx.filter = filter;
ctx.initialized = true;
return 0;
} catch (const std::system_error& e) {
r = -e.code().value();
ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what()
<< ", returning " << r << dendl;
return r;
} catch (const std::exception& e) {
ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what()
<< ", returning -5" << dendl;
return -EIO;
}
}

int RGWSI_RADOS::Pool::List::get_next(const DoutPrefixProvider *dpp,
Expand Down

0 comments on commit e344ad1

Please sign in to comment.