caps_release_delay = cct->_conf.get_val<std::chrono::seconds>(
"client_caps_release_delay");
+ injected_write_delay_secs = std::chrono::duration<int>(
+ cct->_conf.get_val<std::chrono::seconds>("client_inject_write_delay_secs")).count();
+
if (cct->_conf->client_acl_type == "posix_acl")
acl_type = POSIX_ACL;
get_cap_ref(in, CEPH_CAP_FILE_BUFFER);
+ auto delay = get_injected_write_delay_secs();
+ if (unlikely(delay > 0)) {
+ ldout(cct, 20) << __func__ << ": delaying write for " << delay << " seconds" << dendl;
+ client_lock.unlock();
+ sleep(delay);
+ client_lock.lock();
+ }
filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(),
offset, size, bl, ceph::real_clock::now(), 0,
in->truncate_size, in->truncate_seq,
"client_caps_release_delay",
"client_deleg_break_on_open",
"client_deleg_timeout",
+ "client_inject_write_delay_secs",
"client_mount_timeout",
"client_oc_max_dirty",
"client_oc_max_dirty_age",
mount_timeout = cct->_conf.get_val<std::chrono::seconds>(
"client_mount_timeout");
}
+ if (changed.count("client_inject_write_delay_secs")) {
+ injected_write_delay_secs = std::chrono::duration<int>(
+ cct->_conf.get_val<std::chrono::seconds>("client_inject_write_delay_secs")).count();
+ }
}
void intrusive_ptr_add_ref(Inode *in)
struct mount_state_t mount_state;
struct initialize_state_t initialize_state;
+ int get_injected_write_delay_secs() const {
+ return injected_write_delay_secs;
+ }
+
private:
class C_Read_Finisher : public Context {
public:
ceph::coarse_mono_time last_auto_reconnect;
std::chrono::seconds caps_release_delay, mount_timeout;
+ int injected_write_delay_secs;
// trace generation
std::ofstream traceout;
default: 16
services:
- mds_client
- min: 1
\ No newline at end of file
+ min: 1
+- name: client_inject_write_delay_secs
+ type: secs
+ level: dev
+ desc: induce delay in write operation for testing
+ long_desc: Inject a delay in write operation after grabbing required cap references (Fb caps in this case). This config is disabled by default (value of 0) and is to be used for the purpose of validating a race case bug with concurrent fsync.
+ default: 0
+ services:
+ - mds_client
+ min: 0