Skip to content

Commit

Permalink
Merge pull request #52304 from lxbsz/wip-61798
Browse files Browse the repository at this point in the history
pacific: client: only wait for write MDS OPs when unmounting

Reviewed-by: Venky Shankar <vshankar@redhat.com>
  • Loading branch information
yuriw committed Aug 8, 2023
2 parents 2ae9534 + 4667cb8 commit 8fafe24
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/client/Client.cc
Expand Up @@ -6582,11 +6582,18 @@ void Client::_unmount(bool abort)
}

mount_cond.wait(lock, [this] {
if (!mds_requests.empty()) {
ldout(cct, 10) << "waiting on " << mds_requests.size() << " requests"
<< dendl;
// Only wait for write OPs
for (auto& [tid, req] : mds_requests) {
if (req->is_write()) {
ldout(cct, 10) << "waiting for write request '" << tid
<< "' to complete, currently there are "
<< mds_requests.size()
<< " outstanding read/write requests"
<< dendl;
return false;
}
}
return mds_requests.empty();
return true;
});

cwd.reset();
Expand All @@ -6599,7 +6606,7 @@ void Client::_unmount(bool abort)
ldout(cct, 0) << " destroyed lost open file " << fh << " on " << *fh->inode << dendl;
_release_fh(fh);
}

while (!ll_unclosed_fh_set.empty()) {
set<Fh*>::iterator it = ll_unclosed_fh_set.begin();
Fh *fh = *it;
Expand Down Expand Up @@ -11691,6 +11698,9 @@ int Client::_sync_fs()
flush_caps_sync();
ceph_tid_t flush_tid = last_flush_tid;

// flush the mdlog before waiting for unsafe requests.
flush_mdlog_sync();

// wait for unsafe mds requests
wait_unsafe_requests();

Expand Down

0 comments on commit 8fafe24

Please sign in to comment.