m->put();
}
+bool Client::_any_stale_sessions() const
+{
+ assert(client_lock.is_locked_by_me());
+
+ for (const auto &i : mds_sessions) {
+ if (i.second->state == MetaSession::STATE_STALE) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void Client::_kick_stale_sessions()
{
ldout(cct, 1) << "kick_stale_sessions" << dendl;
assert(cct->_conf->client_quota == false || quota_root != nullptr);
if (quota_root && cct->_conf->client_quota_df && quota_root->quota.max_bytes) {
+
+ // Skip the getattr if any sessions are stale, as we don't want to
+ // block `df` if this client has e.g. been evicted, or if the MDS cluster
+ // is unhealthy.
+ if (!_any_stale_sessions()) {
+ int r = _getattr(quota_root, 0, perms, true);
+ if (r != 0) {
+ // Ignore return value: error getting latest inode metadata is not a good
+ // reason to break "df".
+ lderr(cct) << "Error in getattr on quota root 0x"
+ << std::hex << quota_root->ino << std::dec
+ << " statfs result may be outdated" << dendl;
+ }
+ }
+
// Special case: if there is a size quota set on the Inode acting
// as the root for this client mount, then report the quota status
// as the filesystem statistics.
MetaSession *_open_mds_session(mds_rank_t mds);
void _close_mds_session(MetaSession *s);
void _closed_mds_session(MetaSession *s);
+ bool _any_stale_sessions() const;
void _kick_stale_sessions();
void handle_client_session(MClientSession *m);
void send_reconnect(MetaSession *s);