| 13066 | } |
| 13067 | |
| 13068 | void Client::C_nonblocking_fsync_state::advance() |
| 13069 | { |
| 13070 | Context *advancer; |
| 13071 | client_t const whoami = clnt->whoami; // For the benefit of ldout prefix |
| 13072 | |
| 13073 | ldout(clnt->cct, 15) << "Client::C_nonblocking_fsync_state::advance" |
| 13074 | << " progress " << progress |
| 13075 | << " flush_wait " << flush_wait |
| 13076 | << " flush_completed " << flush_completed |
| 13077 | << " result " << result |
| 13078 | << " waitfor_safe " << waitfor_safe |
| 13079 | << " onfinish " << onfinish |
| 13080 | << dendl; |
| 13081 | |
| 13082 | ceph_assert(ceph_mutex_is_locked_by_me(clnt->client_lock)); |
| 13083 | |
| 13084 | switch (progress) { |
| 13085 | case 0: |
| 13086 | ldout(clnt->cct, 15) << "Client::C_nonblocking_fsync_state::advance - case 0" << dendl; |
| 13087 | progress = 1; |
| 13088 | |
| 13089 | if (clnt->cct->_conf->client_oc) { |
| 13090 | Context *finisher = new C_nonblocking_fsync_flush_finisher(clnt, this); |
| 13091 | flush_wait = true; |
| 13092 | tmp_ref = in; // take a reference; C_SaferCond doesn't and _flush won't either |
| 13093 | clnt->_flush(in, finisher); |
| 13094 | ldout(clnt->cct, 15) << "using return-valued form of _fsync" << dendl; |
| 13095 | } |
| 13096 | |
| 13097 | if (!syncdataonly && in->dirty_caps) { |
| 13098 | clnt->check_caps(in, CHECK_CAPS_NODELAY|CHECK_CAPS_SYNCHRONOUS); |
| 13099 | if (in->flushing_caps) |
| 13100 | flush_tid = clnt->last_flush_tid; |
| 13101 | } else { |
| 13102 | ldout(clnt->cct, 10) << "no metadata needs to commit" << dendl; |
| 13103 | } |
| 13104 | |
| 13105 | ldout(clnt->cct, 10) << __func__ <<": in->unsafe_ops=" << in->unsafe_ops.size() << dendl; |
| 13106 | |
| 13107 | if (!syncdataonly && !in->unsafe_ops.empty()) { |
| 13108 | waitfor_safe = true; |
| 13109 | clnt->flush_mdlog_sync(in); |
| 13110 | |
| 13111 | advancer = new C_nonblocking_fsync_state_advancer(clnt, this); |
| 13112 | req = in->unsafe_ops.back(); |
| 13113 | ldout(clnt->cct, 15) << "waiting on unsafe requests, last tid " << req->get_tid() << dendl; |
| 13114 | |
| 13115 | req->get(); |
| 13116 | req->waitfor_safe.push_back(advancer); |
| 13117 | // ------------ here is a state machine break point |
| 13118 | return; |
| 13119 | } |
| 13120 | |
| 13121 | // skip and fall through |
| 13122 | |
| 13123 | case 1: |
| 13124 | ldout(clnt->cct, 15) << "Client::C_nonblocking_fsync_state::advance - case 1" << dendl; |
| 13125 | progress = 2; |
no test coverage detected