]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Kick waiters for max size 191/head
authorSam Lang <sam.lang@inktank.com>
Mon, 1 Apr 2013 14:06:59 +0000 (09:06 -0500)
committerSam Lang <sam.lang@inktank.com>
Wed, 3 Apr 2013 16:36:39 +0000 (11:36 -0500)
If the mds restarts without successfully logging a max size
cap update, the client waits indefinitely in Client::get_caps
on the waitfor_caps list.  So when the client gets an mds map
indicating a new active mds has replaced a down mds, we need to
kick the caps update request.  This patch mimics the behavior
in the kernel by setting the wanted_max_size
and requested_max_size to 0 and wakes up the waiters.

Fixes #4582.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
src/client/Client.cc
src/client/Client.h

index 447d44d618fb02a2b470071b5110aec30fadff39..420c3ad00f2975c51bff384f6af6344392edcc9e 100644 (file)
@@ -1890,6 +1890,8 @@ void Client::handle_mds_map(MMDSMap* m)
        kick_requests(p->second, false);
        kick_flushing_caps(p->second);
        signal_cond_list(p->second->waiting_for_open);
+       kick_maxsize_requests(p->second);
+       wake_inode_waiters(p->second);
       }
       connect_mds_targets(p->first);
     }
@@ -3031,6 +3033,17 @@ void Client::kick_flushing_caps(MetaSession *session)
   }
 }
 
+void Client::kick_maxsize_requests(MetaSession *session)
+{
+  xlist<Cap*>::iterator iter = session->caps.begin();
+  while (!iter.end()){
+    (*iter)->inode->requested_max_size = 0;
+    (*iter)->inode->wanted_max_size = 0;
+    signal_cond_list((*iter)->inode->waitfor_caps);
+    ++iter;
+  }
+}
+
 void SnapRealm::build_snap_context()
 {
   set<snapid_t> snaps;
index 03764aee240e4748c6e46c8a26260c0817d1f140..29a5020c6a63bb1bef5b62c5467970984275ee33 100644 (file)
@@ -426,6 +426,7 @@ protected:
   void flush_caps();
   void flush_caps(Inode *in, MetaSession *session);
   void kick_flushing_caps(MetaSession *session);
+  void kick_maxsize_requests(MetaSession *session);
   int get_caps(Inode *in, int need, int want, int *have, loff_t endoff);
 
   void maybe_update_snaprealm(SnapRealm *realm, snapid_t snap_created, snapid_t snap_highwater,