// Wait for wmi events up to two seconds
#define WMI_EVENT_TIMEOUT 2
+static WnbdHandler* handler = nullptr;
+static ceph::mutex shutdown_lock = ceph::make_mutex("RbdWnbd::ShutdownLock");
+
bool is_process_running(DWORD pid)
{
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
std::thread adapter_monitor_thread;
- ceph::mutex start_lock = ceph::make_mutex("RBDService::StartLocker");
- ceph::mutex shutdown_lock = ceph::make_mutex("RBDService::ShutdownLocker");
+ ceph::mutex start_hook_lock = ceph::make_mutex("RBDService::StartLocker");
+ ceph::mutex stop_hook_lock = ceph::make_mutex("RBDService::ShutdownLocker");
bool started = false;
std::atomic<bool> stop_requsted = false;
}
int run_hook() override {
- std::unique_lock l{start_lock};
+ std::unique_lock l{start_hook_lock};
if (started) {
// The run hook is only supposed to be called once per process,
// however we're staying cautious.
}
if (adapter_monitoring_enabled) {
- adapter_monitor_thread = std::thread(&monitor_wnbd_adapter, this);
+ adapter_monitor_thread = std::thread(
+ &RBDService::monitor_wnbd_adapter, this);
} else {
dout(0) << "WNBD adapter monitoring disabled." << dendl;
}
// Invoked when the service is requested to stop.
int stop_hook() override {
- std::unique_lock l{shutdown_lock};
+ std::unique_lock l{stop_hook_lock};
stop_requsted = true;
*err_msg << "rbd-wnbd: " << err.str();
return -EINVAL;
}
- if (cfg->wnbd_log_level < 0) {
- *err_msg << "rbd-wnbd: Invalid argument for wnbd-log-level";
- return -EINVAL;
- }
} else if (ceph_argparse_witharg(args, i, (int*)&cfg->io_req_workers,
err, "--io-req-workers", (char *)NULL)) {
if (!err.str().empty()) {
#include "global/global_context.h"
-#include "rbd_wnbd.h"
-
WnbdHandler::~WnbdHandler()
{
if (started && wnbd_disk) {
wnbd_props.Flags.FlushSupported = 1;
}
- err = WnbdCreate(&wnbd_props, &RbdWnbdInterface, this, &wnbd_disk);
+ err = WnbdCreate(&wnbd_props, (const PWNBD_INTERFACE) &RbdWnbdInterface,
+ this, &wnbd_disk);
if (err)
goto exit;