mirror of
https://github.com/ceph/ceph
synced 2024-12-29 15:03:33 +00:00
mds: don't add null dentry to frozen stray dir
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
This commit is contained in:
parent
72dab35bd0
commit
9a308ed4a4
@ -794,25 +794,6 @@ CDir *MDCache::get_stray_dir(CInode *in)
|
||||
return straydir;
|
||||
}
|
||||
|
||||
CDentry *MDCache::get_or_create_stray_dentry(CInode *in)
|
||||
{
|
||||
CDir *straydir = get_stray_dir(in);
|
||||
string straydname;
|
||||
in->name_stray_dentry(straydname);
|
||||
CDentry *straydn = straydir->lookup(straydname);
|
||||
if (!straydn) {
|
||||
straydn = straydir->add_null_dentry(straydname);
|
||||
straydn->mark_new();
|
||||
} else {
|
||||
ceph_assert(straydn->get_projected_linkage()->is_null());
|
||||
}
|
||||
|
||||
straydn->state_set(CDentry::STATE_STRAY);
|
||||
return straydn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MDSCacheObject *MDCache::get_object(const MDSCacheObjectInfo &info)
|
||||
{
|
||||
// inode?
|
||||
@ -10813,6 +10794,7 @@ void MDCache::decode_replica_inode(CInode *&in, bufferlist::const_iterator& p, C
|
||||
|
||||
void MDCache::encode_replica_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl)
|
||||
{
|
||||
ceph_assert(straydn->get_num_auth_pins());
|
||||
ENCODE_START(1, 1, bl);
|
||||
uint64_t features = mds->mdsmap->get_up_features();
|
||||
encode_replica_inode(get_myin(), who, bl, features);
|
||||
|
@ -760,7 +760,6 @@ class MDCache {
|
||||
|
||||
void open_foreign_mdsdir(inodeno_t ino, MDSContext *c);
|
||||
CDir *get_stray_dir(CInode *in);
|
||||
CDentry *get_or_create_stray_dentry(CInode *in);
|
||||
|
||||
/**
|
||||
* Find the given dentry (and whether it exists or not), its ancestors,
|
||||
|
@ -3190,23 +3190,39 @@ bool Server::check_fragment_space(MDRequestRef &mdr, CDir *in)
|
||||
|
||||
CDentry* Server::prepare_stray_dentry(MDRequestRef& mdr, CInode *in)
|
||||
{
|
||||
string straydname;
|
||||
in->name_stray_dentry(straydname);
|
||||
|
||||
CDentry *straydn = mdr->straydn;
|
||||
if (straydn) {
|
||||
string straydname;
|
||||
in->name_stray_dentry(straydname);
|
||||
ceph_assert(straydn->get_name() == straydname);
|
||||
return straydn;
|
||||
}
|
||||
|
||||
CDir *straydir = mdcache->get_stray_dir(in);
|
||||
|
||||
if (!mdr->client_request->is_replay() &&
|
||||
!check_fragment_space(mdr, straydir))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
straydn = mdcache->get_or_create_stray_dentry(in);
|
||||
straydn = straydir->lookup(straydname);
|
||||
if (!straydn) {
|
||||
if (straydir->is_frozen_dir()) {
|
||||
dout(10) << __func__ << ": " << *straydir << " is frozen, waiting" << dendl;
|
||||
mds->locker->drop_locks(mdr.get());
|
||||
mdr->drop_local_auth_pins();
|
||||
straydir->add_waiter(CInode::WAIT_UNFREEZE, new C_MDS_RetryRequest(mdcache, mdr));
|
||||
return nullptr;
|
||||
}
|
||||
straydn = straydir->add_null_dentry(straydname);
|
||||
straydn->mark_new();
|
||||
} else {
|
||||
ceph_assert(straydn->get_projected_linkage()->is_null());
|
||||
}
|
||||
|
||||
straydn->state_set(CDentry::STATE_STRAY);
|
||||
mdr->straydn = straydn;
|
||||
mdr->pin(straydn);
|
||||
|
||||
return straydn;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user