mirror of
https://github.com/ceph/ceph
synced 2025-01-03 09:32:43 +00:00
Merge pull request #1838 from ceph/wip-client-time
fs: include client timestamp in all mds requests Reviewed-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
commit
f81c53a716
@ -1356,6 +1356,10 @@ int Client::make_request(MetaRequest *request,
|
||||
// assign a unique tid
|
||||
ceph_tid_t tid = ++last_tid;
|
||||
request->set_tid(tid);
|
||||
|
||||
// and timestamp
|
||||
request->op_stamp = ceph_clock_now(NULL);
|
||||
|
||||
// make note
|
||||
mds_requests[tid] = request->get();
|
||||
if (uid < 0) {
|
||||
@ -1740,6 +1744,7 @@ MClientRequest* Client::build_client_request(MetaRequest *request)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(request->get_op());
|
||||
req->set_tid(request->tid);
|
||||
req->set_stamp(request->op_stamp);
|
||||
memcpy(&req->head, &request->head, sizeof(ceph_mds_request_head));
|
||||
|
||||
// if the filepath's haven't been set, set them!
|
||||
|
@ -27,6 +27,7 @@ private:
|
||||
Dentry *_old_dentry; //associated with path2
|
||||
public:
|
||||
uint64_t tid;
|
||||
utime_t op_stamp;
|
||||
ceph_mds_request_head head;
|
||||
filepath path, path2;
|
||||
bufferlist data;
|
||||
@ -75,7 +76,7 @@ public:
|
||||
|
||||
Inode *target;
|
||||
|
||||
MetaRequest(int op) :
|
||||
MetaRequest(int op) :
|
||||
_inode(NULL), _old_inode(NULL), _other_inode(NULL),
|
||||
_dentry(NULL), _old_dentry(NULL),
|
||||
tid(0),
|
||||
|
@ -538,6 +538,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
|
||||
}
|
||||
|
||||
mdr->done_locking = true;
|
||||
mdr->set_mds_stamp(ceph_clock_now(NULL));
|
||||
result = true;
|
||||
marker.message = "acquired locks";
|
||||
|
||||
|
@ -1857,9 +1857,9 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
|
||||
|
||||
assert(mds->mdlog->entry_is_open());
|
||||
|
||||
// declare now?
|
||||
if (mut->now == utime_t())
|
||||
mut->now = ceph_clock_now(g_ceph_context);
|
||||
// make sure stamp is set
|
||||
if (mut->get_mds_stamp() == utime_t())
|
||||
mut->set_mds_stamp(ceph_clock_now(g_ceph_context));
|
||||
|
||||
if (in->is_base())
|
||||
return;
|
||||
@ -1910,10 +1910,10 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
|
||||
parent->resync_accounted_fragstat();
|
||||
|
||||
if (do_parent_mtime) {
|
||||
pf->fragstat.mtime = mut->now;
|
||||
if (mut->now > pf->rstat.rctime) {
|
||||
pf->fragstat.mtime = mut->get_op_stamp();
|
||||
if (pf->fragstat.mtime > pf->rstat.rctime) {
|
||||
dout(10) << "predirty_journal_parents updating mtime on " << *parent << dendl;
|
||||
pf->rstat.rctime = mut->now;
|
||||
pf->rstat.rctime = pf->fragstat.mtime;
|
||||
} else {
|
||||
dout(10) << "predirty_journal_parents updating mtime UNDERWATER on " << *parent << dendl;
|
||||
}
|
||||
@ -1978,7 +1978,7 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
|
||||
// delay propagating until later?
|
||||
if (!stop && !first &&
|
||||
g_conf->mds_dirstat_min_interval > 0) {
|
||||
double since_last_prop = mut->now - pin->last_dirstat_prop;
|
||||
double since_last_prop = mut->get_mds_stamp() - pin->last_dirstat_prop;
|
||||
if (since_last_prop < g_conf->mds_dirstat_min_interval) {
|
||||
dout(10) << "predirty_journal_parents last prop " << since_last_prop
|
||||
<< " < " << g_conf->mds_dirstat_min_interval
|
||||
@ -2020,7 +2020,7 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
|
||||
assert(mut->wrlocks.count(&pin->nestlock) ||
|
||||
mut->is_slave());
|
||||
|
||||
pin->last_dirstat_prop = mut->now;
|
||||
pin->last_dirstat_prop = mut->get_mds_stamp();
|
||||
|
||||
// dirfrag -> diri
|
||||
mut->auth_pin(pin);
|
||||
@ -8645,6 +8645,7 @@ MDRequestRef MDCache::request_start(MClientRequest *req)
|
||||
MDRequestRef mdr =
|
||||
mds->op_tracker.create_request<MDRequestImpl,MDRequestImpl::Params>(params);
|
||||
active_requests[params.reqid] = mdr;
|
||||
mdr->set_op_stamp(req->get_stamp());
|
||||
dout(7) << "request_start " << *mdr << dendl;
|
||||
return mdr;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void MDRequestImpl::_dump(utime_t now, Formatter *f) const
|
||||
f->dump_int("inode_export_v", slave_request->inode_export_v);
|
||||
f->dump_bool("has_srci_replica",
|
||||
slave_request->srci_replica.length() != 0);
|
||||
f->dump_stream("timestamp_now") << slave_request->now;
|
||||
f->dump_stream("op_stamp") << slave_request->op_stamp;
|
||||
f->close_section(); // request_info
|
||||
}
|
||||
else { // internal request
|
||||
|
@ -39,8 +39,12 @@ struct MutationImpl {
|
||||
metareqid_t reqid;
|
||||
__u32 attempt; // which attempt for this request
|
||||
LogSegment *ls; // the log segment i'm committing to
|
||||
utime_t now;
|
||||
|
||||
private:
|
||||
utime_t mds_stamp; ///< mds-local timestamp (real time)
|
||||
utime_t op_stamp; ///< op timestamp (client provided)
|
||||
|
||||
public:
|
||||
// flag mutation as slave
|
||||
int slave_to_mds; // this is a slave request if >= 0.
|
||||
|
||||
@ -114,6 +118,21 @@ struct MutationImpl {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void set_mds_stamp(utime_t t) {
|
||||
mds_stamp = t;
|
||||
}
|
||||
utime_t get_mds_stamp() const {
|
||||
return mds_stamp;
|
||||
}
|
||||
void set_op_stamp(utime_t t) {
|
||||
op_stamp = t;
|
||||
}
|
||||
utime_t get_op_stamp() const {
|
||||
if (op_stamp != utime_t())
|
||||
return op_stamp;
|
||||
return get_mds_stamp();
|
||||
}
|
||||
|
||||
// pin items in cache
|
||||
void pin(MDSCacheObject *o);
|
||||
void unpin(MDSCacheObject *o);
|
||||
|
@ -1384,6 +1384,7 @@ void Server::handle_slave_request(MMDSSlaveRequest *m)
|
||||
return;
|
||||
}
|
||||
mdr = mdcache->request_start_slave(m->get_reqid(), m->get_attempt(), m);
|
||||
mdr->set_op_stamp(m->op_stamp);
|
||||
}
|
||||
assert(mdr->slave_request == 0); // only one at a time, please!
|
||||
|
||||
@ -1986,7 +1987,7 @@ CInode* Server::prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino
|
||||
|
||||
in->inode.uid = mdr->client_request->get_caller_uid();
|
||||
|
||||
in->inode.ctime = in->inode.mtime = in->inode.atime = mdr->now; // now
|
||||
in->inode.ctime = in->inode.mtime = in->inode.atime = mdr->get_op_stamp();
|
||||
|
||||
MClientRequest *req = mdr->client_request;
|
||||
if (req->get_data().length()) {
|
||||
@ -2611,12 +2612,11 @@ void Server::handle_client_open(MDRequestRef& mdr)
|
||||
}
|
||||
|
||||
// hit pop
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
if (cmode == CEPH_FILE_MODE_RDWR ||
|
||||
cmode == CEPH_FILE_MODE_WR)
|
||||
mds->balancer->hit_inode(mdr->now, cur, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), cur, META_POP_IWR);
|
||||
else
|
||||
mds->balancer->hit_inode(mdr->now, cur, META_POP_IRD,
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), cur, META_POP_IRD,
|
||||
mdr->client_request->get_source().num());
|
||||
|
||||
CDentry *dn = 0;
|
||||
@ -2654,7 +2654,7 @@ public:
|
||||
MDRequestRef null_ref;
|
||||
mds->mdcache->send_dentry_link(dn, null_ref);
|
||||
|
||||
mds->balancer->hit_inode(mdr->now, newi, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), newi, META_POP_IWR);
|
||||
|
||||
MClientReply *reply = new MClientReply(mdr->client_request, 0);
|
||||
reply->set_extra_bl(mdr->reply_extra_bl);
|
||||
@ -2765,8 +2765,6 @@ void Server::handle_client_openc(MDRequestRef& mdr)
|
||||
// created null dn.
|
||||
|
||||
// create inode.
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
SnapRealm *realm = diri->find_snaprealm(); // use directory's realm; inode isn't attached yet.
|
||||
snapid_t follows = realm->get_newest_seq();
|
||||
|
||||
@ -2884,7 +2882,8 @@ void Server::handle_client_readdir(MDRequestRef& mdr)
|
||||
dir->verify_fragstat();
|
||||
#endif
|
||||
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
utime_t now = ceph_clock_now(NULL);
|
||||
mdr->set_mds_stamp(now);
|
||||
|
||||
snapid_t snapid = mdr->snapid;
|
||||
dout(10) << "snapid " << snapid << dendl;
|
||||
@ -2992,7 +2991,7 @@ void Server::handle_client_readdir(MDRequestRef& mdr)
|
||||
// dentry
|
||||
dout(12) << "including dn " << *dn << dendl;
|
||||
::encode(dn->name, dnbl);
|
||||
mds->locker->issue_client_lease(dn, client, dnbl, mdr->now, mdr->session);
|
||||
mds->locker->issue_client_lease(dn, client, dnbl, now, mdr->session);
|
||||
|
||||
// inode
|
||||
dout(12) << "including inode " << *in << dendl;
|
||||
@ -3072,7 +3071,7 @@ public:
|
||||
mds->mdcache->truncate_inode(in, mdr->ls);
|
||||
}
|
||||
|
||||
mds->balancer->hit_inode(mdr->now, in, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), in, META_POP_IWR);
|
||||
|
||||
mds->server->reply_request(mdr, 0);
|
||||
|
||||
@ -3801,7 +3800,7 @@ public:
|
||||
|
||||
mdr->apply();
|
||||
|
||||
mds->balancer->hit_inode(mdr->now, in, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), in, META_POP_IWR);
|
||||
|
||||
mds->server->reply_request(mdr, 0);
|
||||
}
|
||||
@ -3983,7 +3982,7 @@ public:
|
||||
mds->locker->share_inode_max_size(newi);
|
||||
|
||||
// hit pop
|
||||
mds->balancer->hit_inode(mdr->now, newi, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), newi, META_POP_IWR);
|
||||
|
||||
// reply
|
||||
MClientReply *reply = new MClientReply(mdr->client_request, 0);
|
||||
@ -4024,8 +4023,6 @@ void Server::handle_client_mknod(MDRequestRef& mdr)
|
||||
|
||||
SnapRealm *realm = dn->get_dir()->inode->find_snaprealm();
|
||||
snapid_t follows = realm->get_newest_seq();
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
CInode *newi = prepare_new_inode(mdr, dn->get_dir(), inodeno_t(req->head.ino),
|
||||
mode, &layout);
|
||||
assert(newi);
|
||||
@ -4105,7 +4102,6 @@ void Server::handle_client_mkdir(MDRequestRef& mdr)
|
||||
// new inode
|
||||
SnapRealm *realm = dn->get_dir()->inode->find_snaprealm();
|
||||
snapid_t follows = realm->get_newest_seq();
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
unsigned mode = req->head.args.mkdir.mode;
|
||||
mode &= ~S_IFMT;
|
||||
@ -4180,7 +4176,6 @@ void Server::handle_client_symlink(MDRequestRef& mdr)
|
||||
if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
|
||||
return;
|
||||
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
snapid_t follows = dn->get_dir()->inode->find_snaprealm()->get_newest_seq();
|
||||
|
||||
unsigned mode = S_IFLNK | 0777;
|
||||
@ -4252,10 +4247,6 @@ void Server::handle_client_link(MDRequestRef& mdr)
|
||||
if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
|
||||
return;
|
||||
|
||||
// pick mtime
|
||||
if (mdr->now == utime_t())
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
// go!
|
||||
assert(g_conf->mds_kill_link_at != 1);
|
||||
|
||||
@ -4299,7 +4290,7 @@ void Server::_link_local(MDRequestRef& mdr, CDentry *dn, CInode *targeti)
|
||||
// project inode update
|
||||
inode_t *pi = targeti->project_inode();
|
||||
pi->nlink++;
|
||||
pi->ctime = mdr->now;
|
||||
pi->ctime = mdr->get_op_stamp();
|
||||
pi->version = tipv;
|
||||
|
||||
snapid_t follows = dn->get_dir()->inode->find_snaprealm()->get_newest_seq();
|
||||
@ -4339,8 +4330,8 @@ void Server::_link_local_finish(MDRequestRef& mdr, CDentry *dn, CInode *targeti,
|
||||
mds->mdcache->send_dentry_link(dn, null_ref);
|
||||
|
||||
// bump target popularity
|
||||
mds->balancer->hit_inode(mdr->now, targeti, META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->now, dn->get_dir(), META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), targeti, META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->get_mds_stamp(), dn->get_dir(), META_POP_IWR);
|
||||
|
||||
// reply
|
||||
MClientReply *reply = new MClientReply(mdr->client_request, 0);
|
||||
@ -4391,7 +4382,7 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
|
||||
op = MMDSSlaveRequest::OP_UNLINKPREP;
|
||||
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, mdr->attempt, op);
|
||||
targeti->set_object_info(req->get_object_info());
|
||||
req->now = mdr->now;
|
||||
req->op_stamp = mdr->get_op_stamp();
|
||||
mds->send_message_mds(req, linkauth);
|
||||
|
||||
assert(mdr->more()->waiting_on_slave.count(linkauth) == 0);
|
||||
@ -4402,6 +4393,8 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
|
||||
|
||||
assert(g_conf->mds_kill_link_at != 2);
|
||||
|
||||
mdr->set_mds_stamp(ceph_clock_now(NULL));
|
||||
|
||||
// add to event
|
||||
mdr->ls = mdlog->get_current_segment();
|
||||
EUpdate *le = new EUpdate(mdlog, inc ? "link_remote":"unlink_remote");
|
||||
@ -4461,8 +4454,8 @@ void Server::_link_remote_finish(MDRequestRef& mdr, bool inc,
|
||||
mds->mdcache->send_dentry_unlink(dn, NULL, null_ref);
|
||||
|
||||
// bump target popularity
|
||||
mds->balancer->hit_inode(mdr->now, targeti, META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->now, dn->get_dir(), META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), targeti, META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->get_mds_stamp(), dn->get_dir(), META_POP_IWR);
|
||||
|
||||
// reply
|
||||
MClientReply *reply = new MClientReply(mdr->client_request, 0);
|
||||
@ -4517,7 +4510,7 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
|
||||
CDentry::linkage_t *dnl = dn->get_linkage();
|
||||
assert(dnl->is_primary());
|
||||
|
||||
mdr->now = mdr->slave_request->now;
|
||||
mdr->set_op_stamp(mdr->slave_request->op_stamp);
|
||||
|
||||
mdr->auth_pin(targeti);
|
||||
|
||||
@ -4553,7 +4546,7 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
|
||||
::encode(rollback, le->rollback);
|
||||
mdr->more()->rollback_bl = le->rollback;
|
||||
|
||||
pi->ctime = mdr->now;
|
||||
pi->ctime = mdr->get_op_stamp();
|
||||
pi->version = targeti->pre_dirty();
|
||||
|
||||
dout(10) << " projected inode " << pi << " v " << pi->version << dendl;
|
||||
@ -4582,7 +4575,7 @@ void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti)
|
||||
mdr->apply();
|
||||
|
||||
// hit pop
|
||||
mds->balancer->hit_inode(mdr->now, targeti, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), targeti, META_POP_IWR);
|
||||
|
||||
// done.
|
||||
mdr->slave_request->put();
|
||||
@ -4866,9 +4859,6 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
|
||||
}
|
||||
|
||||
// yay!
|
||||
if (mdr->now == utime_t())
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
if (in->is_dir() && in->has_subtree_root_dirfrag()) {
|
||||
// subtree root auths need to be witnesses
|
||||
set<int> witnesses;
|
||||
@ -4897,7 +4887,7 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
|
||||
if (!mdr->more()->waiting_on_slave.empty())
|
||||
return; // we're waiting for a witness.
|
||||
}
|
||||
|
||||
|
||||
// ok!
|
||||
if (dnl->is_remote() && !dnl->get_inode()->is_auth())
|
||||
_link_remote(mdr, false, dn, dnl->get_inode());
|
||||
@ -4957,7 +4947,7 @@ void Server::_unlink_local(MDRequestRef& mdr, CDentry *dn, CDentry *straydn)
|
||||
inode_t *pi = in->project_inode();
|
||||
mdr->add_projected_inode(in); // do this _after_ my dn->pre_dirty().. we apply that one manually.
|
||||
pi->version = in->pre_dirty();
|
||||
pi->ctime = mdr->now;
|
||||
pi->ctime = mdr->get_op_stamp();
|
||||
pi->nlink--;
|
||||
if (pi->nlink == 0)
|
||||
in->state_set(CInode::STATE_ORPHAN);
|
||||
@ -5037,7 +5027,7 @@ void Server::_unlink_local_finish(MDRequestRef& mdr,
|
||||
mdcache->adjust_subtree_after_rename(straydnl->get_inode(), dn->get_dir(), true);
|
||||
|
||||
// bump pop
|
||||
mds->balancer->hit_dir(mdr->now, dn->get_dir(), META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->get_mds_stamp(), dn->get_dir(), META_POP_IWR);
|
||||
|
||||
// reply
|
||||
MClientReply *reply = new MClientReply(mdr->client_request, 0);
|
||||
@ -5065,7 +5055,7 @@ bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, int who, CDentry *dn, CDe
|
||||
MMDSSlaveRequest::OP_RMDIRPREP);
|
||||
dn->make_path(req->srcdnpath);
|
||||
straydn->make_path(req->destdnpath);
|
||||
req->now = mdr->now;
|
||||
req->op_stamp = mdr->get_op_stamp();
|
||||
|
||||
mdcache->replicate_stray(straydn, who, req->stray);
|
||||
|
||||
@ -5118,7 +5108,7 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
|
||||
CDentry *straydn = mdr->straydn;
|
||||
dout(10) << " straydn " << *straydn << dendl;
|
||||
|
||||
mdr->now = mdr->slave_request->now;
|
||||
mdr->set_op_stamp(mdr->slave_request->op_stamp);
|
||||
|
||||
rmdir_rollback rollback;
|
||||
rollback.reqid = mdr->reqid;
|
||||
@ -5722,10 +5712,6 @@ void Server::handle_client_rename(MDRequestRef& mdr)
|
||||
}
|
||||
}
|
||||
|
||||
// -- declare now --
|
||||
if (mdr->now == utime_t())
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
// -- prepare witnesses --
|
||||
|
||||
// do srcdn auth last
|
||||
@ -5772,6 +5758,9 @@ void Server::handle_client_rename(MDRequestRef& mdr)
|
||||
if (!mdr->more()->slaves.empty() && srci->is_dir())
|
||||
assert(g_conf->mds_kill_rename_at != 4);
|
||||
|
||||
// -- declare now --
|
||||
mdr->set_mds_stamp(ceph_clock_now(g_ceph_context));
|
||||
|
||||
// -- prepare journal entry --
|
||||
mdr->ls = mdlog->get_current_segment();
|
||||
EUpdate *le = new EUpdate(mdlog, "rename");
|
||||
@ -5822,9 +5811,9 @@ void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn,
|
||||
assert(g_conf->mds_kill_rename_at != 6);
|
||||
|
||||
// bump popularity
|
||||
mds->balancer->hit_dir(mdr->now, srcdn->get_dir(), META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->get_mds_stamp(), srcdn->get_dir(), META_POP_IWR);
|
||||
if (destdnl->is_remote() && in->is_auth())
|
||||
mds->balancer->hit_inode(mdr->now, in, META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), in, META_POP_IWR);
|
||||
|
||||
// did we import srci? if so, explicitly ack that import that, before we unlock and reply.
|
||||
|
||||
@ -5861,7 +5850,7 @@ bool Server::_rename_prepare_witness(MDRequestRef& mdr, int who, set<int> &witne
|
||||
MMDSSlaveRequest::OP_RENAMEPREP);
|
||||
srcdn->make_path(req->srcdnpath);
|
||||
destdn->make_path(req->destdnpath);
|
||||
req->now = mdr->now;
|
||||
req->op_stamp = mdr->get_op_stamp();
|
||||
|
||||
if (straydn)
|
||||
mdcache->replicate_stray(straydn, who, req->stray);
|
||||
@ -6075,12 +6064,12 @@ void Server::_rename_prepare(MDRequestRef& mdr,
|
||||
|
||||
if (!silent) {
|
||||
if (pi) {
|
||||
pi->ctime = mdr->now;
|
||||
pi->ctime = mdr->get_op_stamp();
|
||||
if (linkmerge)
|
||||
pi->nlink--;
|
||||
}
|
||||
if (tpi) {
|
||||
tpi->ctime = mdr->now;
|
||||
tpi->ctime = mdr->get_op_stamp();
|
||||
tpi->nlink--;
|
||||
if (tpi->nlink == 0)
|
||||
oldin->state_set(CInode::STATE_ORPHAN);
|
||||
@ -6446,7 +6435,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
|
||||
if (destdnl->is_primary() && !linkmerge)
|
||||
assert(straydn);
|
||||
|
||||
mdr->now = mdr->slave_request->now;
|
||||
mdr->set_op_stamp(mdr->slave_request->op_stamp);
|
||||
mdr->more()->srcdn_auth_mds = srcdn->authority().first;
|
||||
|
||||
// set up commit waiter (early, to clean up any freezing etc we do)
|
||||
@ -6655,9 +6644,10 @@ void Server::_logged_slave_rename(MDRequestRef& mdr,
|
||||
destdnl = destdn->get_linkage();
|
||||
|
||||
// bump popularity
|
||||
mds->balancer->hit_dir(mdr->now, srcdn->get_dir(), META_POP_IWR);
|
||||
mds->balancer->hit_dir(mdr->get_mds_stamp(), srcdn->get_dir(), META_POP_IWR);
|
||||
if (destdnl->get_inode() && destdnl->get_inode()->is_auth())
|
||||
mds->balancer->hit_inode(mdr->now, destdnl->get_inode(), META_POP_IWR);
|
||||
mds->balancer->hit_inode(mdr->get_mds_stamp(), destdnl->get_inode(),
|
||||
META_POP_IWR);
|
||||
|
||||
// done.
|
||||
mdr->slave_request->put();
|
||||
@ -6711,7 +6701,8 @@ void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
|
||||
::decode(peer_imported, bp);
|
||||
|
||||
dout(10) << " finishing inode export on " << *destdnl->get_inode() << dendl;
|
||||
mdcache->migrator->finish_export_inode(destdnl->get_inode(), mdr->now,
|
||||
mdcache->migrator->finish_export_inode(destdnl->get_inode(),
|
||||
mdr->get_mds_stamp(),
|
||||
mdr->slave_to_mds, peer_imported, finished);
|
||||
mds->queue_waiters(finished); // this includes SINGLEAUTH waiters.
|
||||
|
||||
@ -7310,13 +7301,11 @@ void Server::handle_client_mksnap(MDRequestRef& mdr)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mdr->now == utime_t())
|
||||
mdr->now = ceph_clock_now(g_ceph_context);
|
||||
|
||||
// allocate a snapid
|
||||
if (!mdr->more()->stid) {
|
||||
// prepare an stid
|
||||
mds->snapclient->prepare_create(diri->ino(), snapname, mdr->now,
|
||||
mds->snapclient->prepare_create(diri->ino(), snapname,
|
||||
mdr->get_mds_stamp(),
|
||||
&mdr->more()->stid, &mdr->more()->snapidbl,
|
||||
new C_MDS_RetryRequest(mds->mdcache, mdr));
|
||||
return;
|
||||
@ -7333,7 +7322,7 @@ void Server::handle_client_mksnap(MDRequestRef& mdr)
|
||||
info.ino = diri->ino();
|
||||
info.snapid = snapid;
|
||||
info.name = snapname;
|
||||
info.stamp = mdr->now;
|
||||
info.stamp = mdr->get_op_stamp();
|
||||
|
||||
inode_t *pi = diri->project_inode();
|
||||
pi->ctime = info.stamp;
|
||||
|
@ -46,8 +46,12 @@
|
||||
// metadata ops.
|
||||
|
||||
class MClientRequest : public Message {
|
||||
static const int HEAD_VERSION = 2;
|
||||
static const int COMPAT_VERSION = 1;
|
||||
|
||||
public:
|
||||
struct ceph_mds_request_head head;
|
||||
utime_t stamp;
|
||||
|
||||
struct Release {
|
||||
mutable ceph_mds_request_release item;
|
||||
@ -76,8 +80,10 @@ public:
|
||||
|
||||
public:
|
||||
// cons
|
||||
MClientRequest() : Message(CEPH_MSG_CLIENT_REQUEST) {}
|
||||
MClientRequest(int op) : Message(CEPH_MSG_CLIENT_REQUEST) {
|
||||
MClientRequest()
|
||||
: Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {}
|
||||
MClientRequest(int op)
|
||||
: Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
|
||||
memset(&head, 0, sizeof(head));
|
||||
head.op = op;
|
||||
}
|
||||
@ -110,6 +116,7 @@ public:
|
||||
}
|
||||
|
||||
// normal fields
|
||||
void set_stamp(utime_t t) { stamp = t; }
|
||||
void set_oldest_client_tid(ceph_tid_t t) { head.oldest_client_tid = t; }
|
||||
void inc_num_fwd() { head.num_fwd = head.num_fwd + 1; }
|
||||
void set_retry_attempt(int a) { head.num_retry = a; }
|
||||
@ -124,7 +131,8 @@ public:
|
||||
void set_replayed_op() {
|
||||
head.flags = head.flags | CEPH_MDS_FLAG_REPLAY;
|
||||
}
|
||||
|
||||
|
||||
utime_t get_stamp() const { return stamp; }
|
||||
ceph_tid_t get_oldest_client_tid() const { return head.oldest_client_tid; }
|
||||
int get_num_fwd() const { return head.num_fwd; }
|
||||
int get_retry_attempt() const { return head.num_retry; }
|
||||
@ -145,6 +153,8 @@ public:
|
||||
::decode(path, p);
|
||||
::decode(path2, p);
|
||||
::decode_nohead(head.num_releases, releases, p);
|
||||
if (header.version >= 2)
|
||||
::decode(stamp, p);
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) {
|
||||
@ -153,6 +163,7 @@ public:
|
||||
::encode(path, payload);
|
||||
::encode(path2, payload);
|
||||
::encode_nohead(releases, payload);
|
||||
::encode(stamp, payload);
|
||||
}
|
||||
|
||||
const char *get_type_name() const { return "creq"; }
|
||||
@ -190,6 +201,8 @@ public:
|
||||
out << " " << get_filepath();
|
||||
if (!get_filepath2().empty())
|
||||
out << " " << get_filepath2();
|
||||
if (stamp != utime_t())
|
||||
out << " " << stamp;
|
||||
if (head.num_retry)
|
||||
out << " RETRY=" << (int)head.num_retry;
|
||||
if (get_flags() & CEPH_MDS_FLAG_REPLAY)
|
||||
|
@ -114,7 +114,7 @@ class MMDSSlaveRequest : public Message {
|
||||
bufferlist inode_export;
|
||||
version_t inode_export_v;
|
||||
bufferlist srci_replica;
|
||||
utime_t now;
|
||||
utime_t op_stamp;
|
||||
|
||||
bufferlist stray; // stray dir + dentry
|
||||
|
||||
@ -158,7 +158,7 @@ public:
|
||||
::encode(srcdnpath, payload);
|
||||
::encode(destdnpath, payload);
|
||||
::encode(witnesses, payload);
|
||||
::encode(now, payload);
|
||||
::encode(op_stamp, payload);
|
||||
::encode(inode_export, payload);
|
||||
::encode(inode_export_v, payload);
|
||||
::encode(srci_replica, payload);
|
||||
@ -176,7 +176,7 @@ public:
|
||||
::decode(srcdnpath, p);
|
||||
::decode(destdnpath, p);
|
||||
::decode(witnesses, p);
|
||||
::decode(now, p);
|
||||
::decode(op_stamp, p);
|
||||
::decode(inode_export, p);
|
||||
::decode(inode_export_v, p);
|
||||
::decode(srci_replica, p);
|
||||
|
Loading…
Reference in New Issue
Block a user