Add a new configuration option of `rbd_invalidate_object_map_on_timeout`,
if disabled and timed out to open/update object map, donot invalidating
object map and return -ETIMEDOUT to APP.
Signed-off-by: songweibin <song.weibin@zte.com.cn>
.set_default(true)
.set_description("validate new image names for RBD compatibility"),
+ Option("rbd_invalidate_object_map_on_timeout", Option::TYPE_BOOL, Option::LEVEL_DEV)
+ .set_default(true)
+ .set_description("true if object map should be invalidated when load or update timeout"),
+
Option("rbd_auto_exclusive_lock_until_manual_request", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("automatically acquire/release exclusive lock until it is explicitly requested"),
return nullptr;
} else if (*ret_val < 0) {
lderr(cct) << "failed to load object map: " << oid << dendl;
+ if (*ret_val == -ETIMEDOUT &&
+ !cct->_conf.get_val<bool>("rbd_invalidate_object_map_on_timeout")) {
+ return m_on_finish;
+ }
+
send_invalidate();
return nullptr;
}
switch (m_state)
{
case STATE_REQUEST:
- if (r < 0) {
+ if (r == -ETIMEDOUT &&
+ !cct->_conf.get_val<bool>("rbd_invalidate_object_map_on_timeout")) {
+ m_state = STATE_TIMEOUT;
+ return true;
+ } else if (r < 0) {
lderr(cct) << "failed to update object map: " << cpp_strerror(r)
<< dendl;
return invalidate();
private:
/**
+ * STATE_TIMEOUT --------\
+ * ^ |
+ * | v
* <start> ---> STATE_REQUEST ---> <finish>
* | ^
* v |
*/
enum State {
STATE_REQUEST,
+ STATE_TIMEOUT,
STATE_INVALIDATE
};