Skip to content

Commit

Permalink
mds: do not try fragmenting or exporting a quiesced directory
Browse files Browse the repository at this point in the history
And handle inode becoming quiesced after op is created.

Fixes: https://tracker.ceph.com/issues/65603
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Apr 29, 2024
1 parent b5c87b0 commit ef2d139
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11685,6 +11685,10 @@ bool MDCache::can_fragment(CInode *diri, const std::vector<CDir*>& dirs)
dout(7) << "can_fragment: i won't fragment mdsdir or .ceph" << dendl;
return false;
}
if (diri->is_quiesced()) {
dout(7) << "can_fragment: directory inode is quiesced" << dendl;
return false;
}

for (const auto& dir : dirs) {
if (dir->scrub_is_in_progress()) {
Expand Down Expand Up @@ -12093,13 +12097,18 @@ void MDCache::dispatch_fragment_dir(const MDRequestRef& mdr)
lov.lock_scatter_gather(&diri->nestlock);
lov.lock_scatter_gather(&diri->filelock);
if (!mds->locker->acquire_locks(mdr, lov, NULL, {}, true)) {
/* if quiescelock cannot be wrlocked, we cannot block with tree frozen */
if (!mdr->is_wrlocked(&diri->quiescelock)) {
mdr->aborted = true;
}
if (!mdr->aborted)
return;
}
}

if (mdr->aborted) {
dout(10) << " can't auth_pin " << *diri << ", requeuing dir "
dout(10) << " can't auth_pin or acquire quiescelock on "
<< *diri << ", requeuing dir "
<< info.dirs.front()->dirfrag() << dendl;
if (info.bits > 0)
mds->balancer->queue_split(info.dirs.front(), false);
Expand Down
7 changes: 7 additions & 0 deletions src/mds/Migrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest)
&& parent->get_parent_dir()->ino() != MDS_INO_MDSDIR(dest)) {
dout(7) << "Cannot export to mds." << dest << " " << *dir << ": in stray directory" << dendl;
return;
} else if (dir->inode->is_quiesced()) {
dout(7) << "Cannot export to mds." << dest << " " << *dir << ": is quiesced" << dendl;
return;
}

if (unlikely(g_conf()->mds_thrash_exports)) {
Expand Down Expand Up @@ -1068,6 +1071,10 @@ void Migrator::dispatch_export_dir(const MDRequestRef& mdr, int count)
lov.add_rdlock(&dir->get_inode()->dirfragtreelock);

if (!mds->locker->acquire_locks(mdr, lov, nullptr, {}, true)) {
/* if quiescelock cannot be wrlocked, we cannot block with dir frozen */
if (!mdr->is_wrlocked(&dir->get_inode()->quiescelock)) {
mdr->aborted = true;
}
if (mdr->aborted)
export_try_cancel(dir);
return;
Expand Down

0 comments on commit ef2d139

Please sign in to comment.