mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
client: handler, include dn mask in trace
This commit is contained in:
parent
8dac09b543
commit
eb67f0c96a
9
src/TODO
9
src/TODO
@ -5,10 +5,17 @@ code cleanup
|
||||
- addr=?
|
||||
|
||||
client leases
|
||||
- make sure callbacks behave
|
||||
- clean up readdir vs stat leases
|
||||
- esp on client.. keep mask/ttl and onetime_mask/onetime_ttl?
|
||||
- time out on mds
|
||||
/- time out on mds
|
||||
- dual-mode? short vs long lease lrus, depending on some simple heuristic...
|
||||
- kick affected locks
|
||||
- client: preemptively release lease on dentry we are unlinking, renaming from/to, etc.
|
||||
- or inode fields we are chmodding, etc.
|
||||
- rework reply trace to allow negative dentries... maybe hard links...
|
||||
- mds: implement release handler
|
||||
|
||||
|
||||
kernel client
|
||||
- make sure link/unlink results reflected by inode/dentry cache (let fill_trace do it? invalidate? do actual update?)
|
||||
|
@ -990,6 +990,9 @@ void Client::dispatch(Message *m)
|
||||
case CEPH_MSG_CLIENT_FILECAPS:
|
||||
handle_file_caps((MClientFileCaps*)m);
|
||||
break;
|
||||
case CEPH_MSG_CLIENT_LOCK:
|
||||
handle_lock((MClientLock*)m);
|
||||
break;
|
||||
|
||||
case CEPH_MSG_STATFS_REPLY:
|
||||
handle_statfs_reply((MStatfsReply*)m);
|
||||
|
@ -575,21 +575,28 @@ void Server::set_trace_dist(Session *session, MClientReply *reply, CInode *in)
|
||||
|
||||
while (true) {
|
||||
// inode
|
||||
r = in->get_client_replica(client);
|
||||
r->mask |= InodeStat::_encode(bl, in);
|
||||
session->touch_replica(r);
|
||||
mdcache->touch_client_replica(r, ttl);
|
||||
int mask = InodeStat::_encode(bl, in);
|
||||
if (mask) {
|
||||
r = in->get_client_replica(client);
|
||||
r->mask |= mask;
|
||||
session->touch_replica(r);
|
||||
mdcache->touch_client_replica(r, ttl);
|
||||
}
|
||||
numi++;
|
||||
|
||||
CDentry *dn = in->get_parent_dn();
|
||||
if (!dn) break;
|
||||
|
||||
// dentry
|
||||
char dmask = 0;
|
||||
::_encode_simple(dn->get_name(), bl);
|
||||
r = dn->get_client_replica(client);
|
||||
r->mask = CEPH_STAT_MASK_DN;
|
||||
session->touch_replica(r);
|
||||
mdcache->touch_client_replica(r, ttl);
|
||||
if (dn->lock.can_rdlock(0)) {
|
||||
r = dn->get_client_replica(client);
|
||||
dmask = r->mask = CEPH_STAT_MASK_DN;
|
||||
session->touch_replica(r);
|
||||
mdcache->touch_client_replica(r, ttl);
|
||||
}
|
||||
::_encode_simple(dmask, bl);
|
||||
|
||||
// dir
|
||||
DirStat::_encode(bl, dn->get_dir(), whoami);
|
||||
|
@ -35,6 +35,8 @@ struct MClientLock : public Message {
|
||||
__u64 ino;
|
||||
string dname;
|
||||
|
||||
|
||||
MClientLock() : Message(CEPH_MSG_CLIENT_LOCK) {}
|
||||
MClientLock(int l, int ac, __u64 i) :
|
||||
Message(CEPH_MSG_CLIENT_LOCK),
|
||||
lock_type(l), action(ac), ino(i) {}
|
||||
@ -52,7 +54,7 @@ struct MClientLock : public Message {
|
||||
|
||||
const char *get_type_name() { return "client_lock"; }
|
||||
void print(ostream& out) {
|
||||
out << "lock(a=" << get_clientlock_action_name(action)
|
||||
out << "client_lock(a=" << get_clientlock_action_name(action)
|
||||
<< " " << get_lock_type_name(lock_type)
|
||||
<< " " << ino;
|
||||
if (dname.length())
|
||||
|
@ -178,6 +178,7 @@ class MClientReply : public Message {
|
||||
list<InodeStat*> trace_in;
|
||||
list<DirStat*> trace_dir;
|
||||
list<string> trace_dn;
|
||||
list<char> trace_dn_mask;
|
||||
bufferlist trace_bl;
|
||||
|
||||
DirStat *dir_dir;
|
||||
@ -297,8 +298,11 @@ class MClientReply : public Message {
|
||||
|
||||
// dentry, dir
|
||||
string ref_dn;
|
||||
char dn_mask;
|
||||
::_decode_simple(ref_dn, p);
|
||||
::_decode_simple(dn_mask, p);
|
||||
trace_dn.push_front(ref_dn);
|
||||
trace_dn_mask.push_front(dn_mask);
|
||||
trace_dir.push_front(new DirStat(p));
|
||||
}
|
||||
assert(p.end());
|
||||
@ -316,6 +320,10 @@ class MClientReply : public Message {
|
||||
if (trace_in.empty() && trace_bl.length()) _decode_trace();
|
||||
return trace_dn;
|
||||
}
|
||||
const list<char>& get_trace_dn_mask() {
|
||||
if (trace_in.empty() && trace_bl.length()) _decode_trace();
|
||||
return trace_dn_mask;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
@ -55,6 +55,7 @@ using namespace std;
|
||||
#include "messages/MClientRequestForward.h"
|
||||
#include "messages/MClientReply.h"
|
||||
#include "messages/MClientFileCaps.h"
|
||||
#include "messages/MClientLock.h"
|
||||
|
||||
#include "messages/MMDSSlaveRequest.h"
|
||||
|
||||
@ -240,6 +241,9 @@ decode_message(ceph_msg_header& env, bufferlist& front, bufferlist& data)
|
||||
case CEPH_MSG_CLIENT_FILECAPS:
|
||||
m = new MClientFileCaps;
|
||||
break;
|
||||
case CEPH_MSG_CLIENT_LOCK:
|
||||
m = new MClientLock;
|
||||
break;
|
||||
|
||||
// mds
|
||||
case MSG_MDS_SLAVE_REQUEST:
|
||||
|
Loading…
Reference in New Issue
Block a user