From: Zhi Zhang Date: Wed, 16 May 2018 03:21:48 +0000 (+0800) Subject: mds: broadcast quota to relevant clients when quota is explicitly set X-Git-Tag: v12.2.6~70^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b79f5623c214ab78f6771207d5676e176d060e9d;p=ceph.git mds: broadcast quota to relevant clients when quota is explicitly set Try to broadcast quota to relevant clients proactively if quota is explicitly set by someone, in case that client won't get quota update for a long time. Fixes: http://tracker.ceph.com/issues/24133 Signed-off-by: Zhi Zhang (cherry picked from commit b2a7643b102dbbb8221dcb8a785db5e4276ac284) --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index c10cc2fe4f8d..3e338076d799 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -1963,7 +1963,7 @@ void MDCache::project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accou } } -void MDCache::broadcast_quota_to_client(CInode *in) +void MDCache::broadcast_quota_to_client(CInode *in, client_t exclude_ct) { if (!in->is_auth() || in->is_frozen()) return; @@ -1982,6 +1982,10 @@ void MDCache::broadcast_quota_to_client(CInode *in) continue; Capability *cap = it->second; + + if (exclude_ct >= 0 && exclude_ct != it->first) + goto update; + if (cap->last_rbytes == i->rstat.rbytes && cap->last_rsize == i->rstat.rsize()) continue; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 3d3f9686414b..e554264c47b0 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -402,7 +402,7 @@ public: void project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accounted_rstat, snapid_t ofirst, snapid_t last, CInode *pin, bool cow_head); - void broadcast_quota_to_client(CInode *in); + void broadcast_quota_to_client(CInode *in, client_t exclude_ct = -1); void predirty_journal_parents(MutationRef mut, EMetaBlob *blob, CInode *in, CDir *parent, int flags, int linkunlink=0, diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 5132ece9e57c..c437d68aa070 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -4675,6 +4675,9 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur, mdr->no_early_reply = true; pip = &pi.inode; + + client_t exclude_ct = mdr->get_client(); + mdcache->broadcast_quota_to_client(cur, exclude_ct); } else if (name.find("ceph.dir.pin") == 0) { if (!cur->is_dir() || cur->is_root()) { respond_to_request(mdr, -EINVAL);