]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: factor out do_realm_split_notify, call on snap lock update
authorSage Weil <sage@newdream.net>
Tue, 5 Aug 2008 04:03:07 +0000 (21:03 -0700)
committerSage Weil <sage@newdream.net>
Tue, 5 Aug 2008 04:03:07 +0000 (21:03 -0700)
src/mds/CInode.cc
src/mds/MDCache.cc
src/mds/MDCache.h

index ddeb18233f35d79ae6331409415b35c4b1ec4551..51907b59839bc82bb2a55f35cc1f58ac82690f00 100644 (file)
@@ -837,7 +837,14 @@ void CInode::decode_lock_state(int type, bufferlist& bl)
     break;
 
   case CEPH_LOCK_ISNAP:
-    decode_snap(p);
+    {
+      bool had = snaprealm ? true:false;
+      decode_snap(p);
+      if (!had && snaprealm) {
+       assert(!is_auth());
+       mdcache->do_realm_split_notify(this);
+      }
+    }
     break;
 
   default:
index 1615378b70a9755b2d1f6466f06e1c739b5ad7e3..4cc111b5d90abe926330b23d6c28a539f4cdacd7 100644 (file)
@@ -6113,28 +6113,11 @@ void MDCache::snaprealm_create(MDRequest *mdr, CInode *in)
   mds->mdlog->submit_entry(le, new C_MDC_snaprealm_create_finish(this, mdr, mut, in));
 }
 
-void MDCache::_snaprealm_create_finish(MDRequest *mdr, Mutation *mut, CInode *in)
-{
-  dout(10) << "_snaprealm_create_finish " << *in << dendl;
-
-  // apply
-  in->pop_and_dirty_projected_inode(mut->ls);
-  mut->apply();
-  mut->cleanup();
-  delete mut;
-
-  // tell table we've committed
-  mds->snapclient->commit(mdr->more()->stid, mut->ls);
-
-  // create
-  in->open_snaprealm();
-  in->snaprealm->seq = in->snaprealm->created = mdr->more()->stid;
-
-  // split existing caps
-  SnapRealm *parent = in->snaprealm->parent;
-  assert(parent);
-  assert(parent->open_children.count(in->snaprealm));
 
+void MDCache::do_realm_split_notify(CInode *in)
+{
+  dout(10) << "do_realm_split_notify " << *in->snaprealm << " " << *in << dendl;
+  
   // notify clients of update|split
   list<inodeno_t> split_inos;
   for (xlist<CInode*>::iterator p = in->snaprealm->inodes_with_caps.begin(); !p.end(); ++p)
@@ -6178,6 +6161,26 @@ void MDCache::_snaprealm_create_finish(MDRequest *mdr, Mutation *mut, CInode *in
   }
   
   send_realm_splits(updates);
+}
+
+void MDCache::_snaprealm_create_finish(MDRequest *mdr, Mutation *mut, CInode *in)
+{
+  dout(10) << "_snaprealm_create_finish " << *in << dendl;
+
+  // apply
+  in->pop_and_dirty_projected_inode(mut->ls);
+  mut->apply();
+  mut->cleanup();
+  delete mut;
+
+  // tell table we've committed
+  mds->snapclient->commit(mdr->more()->stid, mut->ls);
+
+  // create
+  in->open_snaprealm();
+  in->snaprealm->seq = in->snaprealm->created = mdr->more()->stid;
+
+  do_realm_split_notify(in);
 
   /*
   static int count = 5;
index 6007f3be9d546f61f8ff267c5dd41a40f038a506..68e8609257599cf8ec7f63229bec35f686537984 100644 (file)
@@ -665,6 +665,7 @@ public:
   void process_reconnected_caps();
   void prepare_realm_split(SnapRealm *realm, int client, inodeno_t ino,
                           map<int,MClientSnap*>& splits);
+  void do_realm_split_notify(CInode *in);
   void send_realm_splits(map<int,MClientSnap*>& splits);
   void rejoin_import_cap(CInode *in, int client, ceph_mds_cap_reconnect& icr, int frommds);
   void finish_snaprealm_reconnect(int client, SnapRealm *realm, snapid_t seq);