Merge pull request #50939 from pkalever/logging_improve

librbd: on notify_quiesce() show attempts in a better format

Reviewed-by: Mykola Golub <mgolub@suse.com>
Reviewed-by: N Balachandran <nibalach@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Ilya Dryomov 2023-04-13 20:21:27 +02:00 committed by GitHub
commit ebc99c9821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 20 deletions

View File

@ -393,37 +393,35 @@ void ImageWatcher<I>::notify_quiesce(uint64_t *request_id,
AsyncRequestId async_request_id(get_client_id(), *request_id);
auto attempts = m_image_ctx.config.template get_val<uint64_t>(
auto total_attempts = m_image_ctx.config.template get_val<uint64_t>(
"rbd_quiesce_notification_attempts");
notify_quiesce(async_request_id, attempts, prog_ctx, on_finish);
notify_quiesce(async_request_id, 1, total_attempts, prog_ctx, on_finish);
}
template <typename I>
void ImageWatcher<I>::notify_quiesce(const AsyncRequestId &async_request_id,
size_t attempts, ProgressContext &prog_ctx,
size_t attempt, size_t total_attempts,
ProgressContext &prog_ctx,
Context *on_finish) {
ceph_assert(attempt <= total_attempts);
ldout(m_image_ctx.cct, 10) << this << " " << __func__ << ": async_request_id="
<< async_request_id << " attempts=" << attempts
<< dendl;
<< async_request_id << " attempts @ "
<< attempt << "/" << total_attempts << dendl;
ceph_assert(attempts > 0);
auto notify_response = new watcher::NotifyResponse();
auto on_notify = new LambdaContext(
[notify_response=std::unique_ptr<watcher::NotifyResponse>(notify_response),
this, async_request_id, &prog_ctx, on_finish, attempts=attempts-1](int r) {
auto total_attempts = m_image_ctx.config.template get_val<uint64_t>(
"rbd_quiesce_notification_attempts");
if (total_attempts < attempts) {
total_attempts = attempts;
}
prog_ctx.update_progress(total_attempts - attempts, total_attempts);
this, async_request_id, attempt, total_attempts, &prog_ctx,
on_finish](int r) {
prog_ctx.update_progress(attempt, total_attempts);
if (r == -ETIMEDOUT) {
ldout(m_image_ctx.cct, 10) << this << " " << __func__ << ": async_request_id="
<< async_request_id << " timed out" << dendl;
if (attempts > 0) {
notify_quiesce(async_request_id, attempts, prog_ctx, on_finish);
ldout(m_image_ctx.cct, 10) << this << " " << __func__
<< ": async_request_id=" << async_request_id
<< " timed out" << dendl;
if (attempt < total_attempts) {
notify_quiesce(async_request_id, attempt + 1, total_attempts,
prog_ctx, on_finish);
return;
}
} else if (r == 0) {

View File

@ -241,8 +241,8 @@ private:
void cancel_quiesce_requests();
void notify_quiesce(const watch_notify::AsyncRequestId &async_request_id,
size_t attempts, ProgressContext &prog_ctx,
Context *on_finish);
size_t attempt, size_t total_attempts,
ProgressContext &prog_ctx, Context *on_finish);
bool handle_operation_request(
const watch_notify::AsyncRequestId& async_request_id,