rgw_acl_swift.cc
rgw_aio.cc
rgw_aio_throttle.cc
+ rgw_asio_thread.cc
rgw_auth.cc
rgw_auth_s3.cc
rgw_arn.cc
#include "rgw_tools.h"
#include "rgw_acl_s3.h"
#include "rgw_aio_throttle.h"
+#include "rgw_asio_thread.h"
#include "rgw_compression.h"
-#include "common/BackTrace.h"
#define dout_subsys ceph_subsys_rgw
}
return -ec.value();
}
- // work on asio threads should be asynchronous, so warn when they block
- if (is_asio_thread) {
- ldpp_dout(dpp, 20) << "WARNING: blocking librados call" << dendl;
-#ifdef _BACKTRACE_LOGGING
- ldpp_dout(dpp, 20) << "BACKTRACE: " << __func__ << ": " << ClibBackTrace(0) << dendl;
-#endif
- }
+ maybe_warn_about_blocking(dpp);
return ioctx.operate(oid, op, nullptr, flags);
}
librados::async_operate(yield, ioctx, oid, op, flags, trace_info, yield[ec]);
return -ec.value();
}
- if (is_asio_thread) {
- ldpp_dout(dpp, 20) << "WARNING: blocking librados call" << dendl;
-#ifdef _BACKTRACE_LOGGING
- ldpp_dout(dpp, 20) << "BACKTRACE: " << __func__ << ": " << ClibBackTrace(0) << dendl;
-#endif
- }
+ maybe_warn_about_blocking(dpp);
return ioctx.operate(oid, op, flags, trace_info);
}
}
return -ec.value();
}
- if (is_asio_thread) {
- ldpp_dout(dpp, 20) << "WARNING: blocking librados call" << dendl;
-#ifdef _BACKTRACE_LOGGING
- ldpp_dout(dpp, 20) << "BACKTRACE: " << __func__ << ": " << ClibBackTrace(0) << dendl;
-#endif
- }
+ maybe_warn_about_blocking(dpp);
return ioctx.notify2(oid, bl, timeout_ms, pbl);
}
void rgw_filter_attrset(std::map<std::string, bufferlist>& unfiltered_attrset, const std::string& check_prefix,
std::map<std::string, bufferlist> *attrset);
-/// indicates whether the current thread is in boost::asio::io_context::run(),
-/// used to log warnings if synchronous librados calls are made
-extern thread_local bool is_asio_thread;
-
/// perform the rados operation, using the yield context when given
int rgw_rados_operate(const DoutPrefixProvider *dpp, librados::IoCtx& ioctx, const std::string& oid,
librados::ObjectReadOperation *op, bufferlist* pbl,
#include "include/str_list.h"
#include "include/stringify.h"
#include "rgw_main.h"
+#include "rgw_asio_thread.h"
#include "rgw_common.h"
#include "rgw_sal.h"
#include "rgw_sal_config.h"
#include "rgw_asio_client.h"
#include "rgw_asio_frontend.h"
+#include "rgw_asio_thread.h"
#ifdef WITH_RADOSGW_BEAST_OPENSSL
#include <boost/asio/ssl.hpp>
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright contributors to the Ceph project
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "rgw_asio_thread.h"
+
+#include "common/BackTrace.h"
+#include "common/dout.h"
+
+thread_local bool is_asio_thread = false;
+
+void maybe_warn_about_blocking(const DoutPrefixProvider* dpp)
+{
+ // work on asio threads should be asynchronous, so warn when they block
+ if (!is_asio_thread) {
+ return;
+ }
+
+ ldpp_dout(dpp, 20) << "WARNING: blocking librados call" << dendl;
+#ifdef _BACKTRACE_LOGGING
+ ldpp_dout(dpp, 20) << "BACKTRACE: " << ClibBackTrace(0) << dendl;
+#endif
+}
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright contributors to the Ceph project
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#pragma once
+
+class DoutPrefixProvider;
+
+/// indicates whether the current thread is in boost::asio::io_context::run(),
+/// used to log warnings if synchronous librados calls are made
+extern thread_local bool is_asio_thread;
+
+/// call when an operation will block the calling thread due to an empty
+/// optional_yield. a warning is logged when is_asio_thread is true
+void maybe_warn_about_blocking(const DoutPrefixProvider* dpp);
using namespace std;
using namespace ceph::crypto;
-thread_local bool is_asio_thread = false;
-
rgw_err::
rgw_err()
{
#include <curl/easy.h>
#include <curl/multi.h>
+#include "rgw_asio_thread.h"
#include "rgw_common.h"
#include "rgw_http_client.h"
#include "rgw_http_errors.h"
async_wait(yield.get_executor(), l, yield[ec]);
return -ec.value();
}
- // work on asio threads should be asynchronous, so warn when they block
- if (is_asio_thread) {
- dout(20) << "WARNING: blocking http request" << dendl;
- }
+ maybe_warn_about_blocking(dpp);
+
cond.wait(l, [this]{return done==true;});
return ret;
}