diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2019-03-19 21:15:21 +0100 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2019-03-19 21:15:21 +0100 |
commit | 356ffc7103134833f196e2faae5f8e97155d7c24 (patch) | |
tree | b61dba8e857e3234b78653a1392d6264b241450b /src/mds/Migrator.cc | |
parent | Merge PR #26895 into master (diff) | |
parent | mds: avoid revoking Fsx from loner during directory fragmentation (diff) | |
download | ceph-356ffc7103134833f196e2faae5f8e97155d7c24.tar.xz ceph-356ffc7103134833f196e2faae5f8e97155d7c24.zip |
Merge PR #26817 into master
* refs/pull/26817/head:
mds: avoid revoking Fsx from loner during directory fragmentation
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Diffstat (limited to 'src/mds/Migrator.cc')
-rw-r--r-- | src/mds/Migrator.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 2d8de84642f..f3d1a07bf03 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -1071,8 +1071,8 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count) // are not auth MDS of the subtree root at the time they receive the // lock messages. So the auth MDS of the subtree root inode may get no // or duplicated fragstat/neststat for the subtree root dirfrag. - lov.add_wrlock(&dir->get_inode()->filelock); - lov.add_wrlock(&dir->get_inode()->nestlock); + lov.lock_scatter_gather(&dir->get_inode()->filelock); + lov.lock_scatter_gather(&dir->get_inode()->nestlock); if (dir->get_inode()->is_auth()) { dir->get_inode()->filelock.set_scatter_wanted(); dir->get_inode()->nestlock.set_scatter_wanted(); @@ -1264,8 +1264,9 @@ void Migrator::export_frozen(CDir *dir, uint64_t tid) get_export_lock_set(dir, lov); if ((diri->is_auth() && diri->is_frozen()) || !mds->locker->can_rdlock_set(lov) || - !diri->filelock.can_wrlock(-1) || - !diri->nestlock.can_wrlock(-1)) { + // for pinning scatter gather. loner has a higher chance to get wrlock + !diri->filelock.can_wrlock(diri->get_loner()) || + !diri->nestlock.can_wrlock(diri->get_loner())) { dout(7) << "export_dir couldn't acquire all needed locks, failing. " << *dir << dendl; export_try_cancel(dir); @@ -2552,8 +2553,9 @@ void Migrator::handle_export_prep(const MExportDirPrep::const_ref &m, bool did_a dout(7) << " all ready, noting auth and freezing import region" << dendl; if (!mds->mdcache->is_readonly() && - diri->filelock.can_wrlock(-1) && - diri->nestlock.can_wrlock(-1)) { + // for pinning scatter gather. loner has a higher chance to get wrlock + diri->filelock.can_wrlock(diri->get_loner()) && + diri->nestlock.can_wrlock(diri->get_loner())) { it->second.mut = new MutationImpl(); // force some locks. hacky. mds->locker->wrlock_force(&dir->inode->filelock, it->second.mut); |