]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: broadcast quota to relevant clients when quota is explicitly set 22141/head
authorZhi Zhang <willzzhang@tencent.com>
Wed, 16 May 2018 03:21:48 +0000 (11:21 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 22 May 2018 03:35:02 +0000 (11:35 +0800)
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 <zhangz.david@outlook.com>
(cherry picked from commit b2a7643b102dbbb8221dcb8a785db5e4276ac284)

src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/Server.cc

index a7e4d4b6731003e9e0c14ce7e0c378d0af3c948d..c526549ca0caa205d0fdf981a4a7e96b4cfe5a07 100644 (file)
@@ -2001,7 +2001,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 (!(mds->is_active() || mds->is_stopping()))
     return;
@@ -2026,6 +2026,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;
index b952c7fe9461b6c595e3e575191a10ead3f7f574..76d05a09bc58b54016beb0eadc7247924bf54558 100644 (file)
@@ -404,7 +404,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,
index d68f863c872581782a535a95481060d2ed15c66f..20a03e40b3799a64ebde9cd497eb1ae25cc8d010 100644 (file)
@@ -4850,6 +4850,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);