Merge PR #36672 into master

* refs/pull/36672/head:
	client: handle readdir reply without Fs cap

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2020-08-31 13:19:22 -07:00
commit 3a6f9d15fe
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -715,7 +715,6 @@ void Client::trim_dentry(Dentry *dn)
<< dendl;
if (dn->inode) {
Inode *diri = dn->dir->parent_inode;
diri->dir_release_count++;
clear_dir_complete_and_ordered(diri, true);
}
unlink(dn, false, false); // drop dir, drop dentry
@ -1025,13 +1024,11 @@ Dentry *Client::insert_dentry_inode(Dir *dir, const string& dname, LeaseStat *dl
if (old_dentry) {
if (old_dentry->dir != dir) {
Inode *old_diri = old_dentry->dir->parent_inode;
old_diri->dir_ordered_count++;
clear_dir_complete_and_ordered(old_diri, false);
}
unlink(old_dentry, dir == old_dentry->dir, false); // drop dentry, keep dir open if its the same dir
}
Inode *diri = dir->parent_inode;
diri->dir_ordered_count++;
clear_dir_complete_and_ordered(diri, false);
dn = link(dir, dname, in, dn);
}
@ -1088,6 +1085,10 @@ void Client::update_dir_dist(Inode *in, DirStat *dst)
void Client::clear_dir_complete_and_ordered(Inode *diri, bool complete)
{
if (complete)
diri->dir_release_count++;
else
diri->dir_ordered_count++;
if (diri->flags & I_COMPLETE) {
if (complete) {
ldout(cct, 10) << " clearing (I_COMPLETE|I_DIR_ORDERED) on " << *diri << dendl;
@ -1292,7 +1293,6 @@ Inode* Client::insert_trace(MetaRequest *request, MetaSession *session)
Dentry *d = request->dentry();
if (d) {
Inode *diri = d->dir->parent_inode;
diri->dir_release_count++;
clear_dir_complete_and_ordered(diri, true);
}
@ -1380,7 +1380,6 @@ Inode* Client::insert_trace(MetaRequest *request, MetaSession *session)
if (diri->dir && diri->dir->dentries.count(dname)) {
dn = diri->dir->dentries[dname];
if (dn->inode) {
diri->dir_ordered_count++;
clear_dir_complete_and_ordered(diri, false);
unlink(dn, true, true); // keep dir, dentry
}
@ -3151,7 +3150,6 @@ Dentry* Client::link(Dir *dir, const string& name, Inode *in, Dentry *dn)
Dentry *olddn = in->get_first_parent();
ceph_assert(olddn->dir != dir || olddn->name != name);
Inode *old_diri = olddn->dir->parent_inode;
old_diri->dir_release_count++;
clear_dir_complete_and_ordered(old_diri, true);
unlink(olddn, true, true); // keep dir, dentry
}
@ -4065,10 +4063,10 @@ void Client::check_cap_issue(Inode *in, unsigned issued)
!(had & CEPH_CAP_FILE_CACHE))
in->cache_gen++;
if ((issued & CEPH_CAP_FILE_SHARED) &&
!(had & CEPH_CAP_FILE_SHARED)) {
in->shared_gen++;
if ((issued & CEPH_CAP_FILE_SHARED) !=
(had & CEPH_CAP_FILE_SHARED)) {
if (issued & CEPH_CAP_FILE_SHARED)
in->shared_gen++;
if (in->is_dir())
clear_dir_complete_and_ordered(in, true);
}