queue_reap_ioc and reap_ioc logic was necessary for BlueFS's _close_writer() method.
At one point it did not perform aio_wait(), and there was race condition in access/deletion to IOContext object.
Now we can simply delete it after successfull aio_wait().
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
return create_with_type(device_type, cct, path, cb, cbpriv, d_cb, d_cbpriv);
}
-void BlockDevice::queue_reap_ioc(IOContext *ioc)
-{
- std::lock_guard l(ioc_reap_lock);
- if (ioc_reap_count.load() == 0)
- ++ioc_reap_count;
- ioc_reap_queue.push_back(ioc);
-}
-
-void BlockDevice::reap_ioc()
-{
- if (ioc_reap_count.load()) {
- std::lock_guard l(ioc_reap_lock);
- for (auto p : ioc_reap_queue) {
- dout(20) << __func__ << " reap ioc " << p << dendl;
- delete p;
- }
- ioc_reap_queue.clear();
- --ioc_reap_count;
- }
-}
-
bool BlockDevice::is_valid_io(uint64_t off, uint64_t len) const {
bool ret = (off % block_size == 0 &&
len % block_size == 0 &&
virtual int queue_discard(interval_set<uint64_t> &to_release) { return -1; }
virtual void discard_drain() { return; }
- void queue_reap_ioc(IOContext *ioc);
- void reap_ioc();
-
// for managing buffered readers/writers
virtual int invalidate_cache(uint64_t off, uint64_t len) = 0;
virtual int open(const std::string& path) = 0;
}
}
}
- reap_ioc();
if (cct->_conf->bdev_inject_crash) {
++inject_crash_count;
if (inject_crash_count * cct->_conf->bdev_aio_poll_ms / 1000 >
}
}
}
- reap_ioc();
dout(10) << __func__ << " end" << dendl;
}
uint32_t block_size;
uint32_t max_queue_depth;
struct spdk_nvme_qpair *qpair;
- bool reap_io = false;
int alloc_buf_from_pool(Task *t, bool write);
public:
}
data_buf_list.push_front(*reinterpret_cast<data_cache_buf *>(b));
}
-
- bdev->queue_number++;
- if (bdev->queue_number.load() == 1)
- reap_io = true;
}
~SharedDriverQueueData() {
if (qpair) {
spdk_nvme_ctrlr_free_io_qpair(qpair);
- bdev->queue_number--;
}
data_buf_list.clear_and_dispose(spdk_dma_free);
}
}
- if (reap_io)
- bdev->reap_ioc();
dout(20) << __func__ << " end" << dendl;
}
string name;
public:
- std::atomic_int queue_number = {0};
SharedDriverData *get_driver() { return driver; }
NVMEDevice(CephContext* cct, aio_callback_t cb, void *cbpriv);
}
}
}
- reap_ioc();
if (cct->_conf->bdev_inject_crash) {
++inject_crash_count;
if (inject_crash_count * cct->_conf->bdev_aio_poll_ms / 1000 >
}
}
}
- reap_ioc();
dout(10) << __func__ << " end" << dendl;
}
if (bdev[i]) {
if (h->iocv[i]) {
h->iocv[i]->aio_wait();
- bdev[i]->queue_reap_ioc(h->iocv[i]);
+ delete h->iocv[i];
}
}
}