]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: auth_pin head/snap pairs for all need_snapflush entries
authorSage Weil <sage@newdream.net>
Fri, 29 Oct 2010 20:06:49 +0000 (13:06 -0700)
committerSage Weil <sage@newdream.net>
Fri, 29 Oct 2010 20:07:19 +0000 (13:07 -0700)
This ensures that when snap metadata is flushed, we will be auth on both
inodes and be able to do the update properly.  This isn't the nicest
solution ever, since it can make migrations laggy, but it's the simplest.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/CInode.cc

index bd9085d60f942656d0ffb3535c0d0dfaf0464ba5..d6c641b4166c9763b1eb4db296fd754bef86ba52 100644 (file)
@@ -231,9 +231,16 @@ void CInode::add_need_snapflush(CInode *snapin, snapid_t snapid, client_t client
 
   if (client_need_snapflush.empty()) {
     get(CInode::PIN_NEEDSNAPFLUSH);
+
+    // FIXME: this is non-optimal, as we'll block freezes/migrations for potentially
+    // long periods waiting for clients to flush their snaps.
+    auth_pin(this);   // pin head inode...
   }
 
   set<client_t>& clients = client_need_snapflush[snapid];
+  if (clients.empty())
+    snapin->auth_pin(this);  // ...and pin snapped/old inode!
+  
   clients.insert(client);
 }
 
@@ -244,9 +251,11 @@ void CInode::remove_need_snapflush(CInode *snapin, snapid_t snapid, client_t cli
   clients.erase(client);
   if (clients.empty()) {
     client_need_snapflush.erase(snapid);
+    snapin->auth_unpin(this);
 
     if (client_need_snapflush.empty()) {
       put(CInode::PIN_NEEDSNAPFLUSH);
+      auth_unpin(this);
     }
   }
 }