client: encode inode's parent/d_name in cap_reconnect_t

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
This commit is contained in:
Yan, Zheng 2020-07-06 17:04:51 +08:00
parent 44f67be02b
commit 7f43840fd3
4 changed files with 21 additions and 4 deletions

View File

@ -1037,6 +1037,8 @@ void Client::update_dentry_lease(Dentry *dn, LeaseStat *dlease, utime_t from, Me
}
}
dn->cap_shared_gen = dn->dir->parent_inode->shared_gen;
if (dlease->mask & CEPH_LEASE_PRIMARY_LINK)
dn->mark_primary();
}
@ -2825,7 +2827,7 @@ void Client::send_reconnect(MetaSession *session)
<< " wants " << ccap_string(in->caps_wanted())
<< dendl;
filepath path;
in->make_long_path(path);
in->make_short_path(path);
ldout(cct, 10) << " path " << path << dendl;
bufferlist flockbl;

View File

@ -64,6 +64,10 @@ public:
inode.reset();
dir->num_null_dentries++;
}
void mark_primary() {
if (inode && inode->dentries.front() != this)
inode->dentries.push_front(&inode_xlist_link);
}
void detach(void) {
ceph_assert(!inode);
auto p = dir->dentries.find(name);

View File

@ -95,9 +95,19 @@ void Inode::make_long_path(filepath& p)
dn->dir->parent_inode->make_long_path(p);
p.push_dentry(dn->name);
} else if (snapdir_parent) {
snapdir_parent->make_nosnap_relative_path(p);
string empty;
p.push_dentry(empty);
make_nosnap_relative_path(p);
} else
p = filepath(ino);
}
void Inode::make_short_path(filepath& p)
{
if (!dentries.empty()) {
Dentry *dn = get_first_parent();
ceph_assert(dn->dir && dn->dir->parent_inode);
p = filepath(dn->name, dn->dir->parent_inode->ino);
} else if (snapdir_parent) {
make_nosnap_relative_path(p);
} else
p = filepath(ino);
}

View File

@ -238,6 +238,7 @@ struct Inode {
}
void make_long_path(filepath& p);
void make_short_path(filepath& p);
void make_nosnap_relative_path(filepath& p);
void get();