]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: skip client snap notification on unlink
authorSage Weil <sage@newdream.net>
Fri, 23 Apr 2010 18:07:16 +0000 (11:07 -0700)
committerSage Weil <sage@newdream.net>
Fri, 23 Apr 2010 18:07:16 +0000 (11:07 -0700)
This is cheating a bit, but should be harmless.  Basically, we spit off the
snaprealm when we unlink to keep the hierarchy vs snaprealm invariants
intact.  But we don't really care if the client does so, so we skip the
client_snap notifications.

That means the client will leave unlinked inodes in the realm they were
in at the time of unlink.  I'm pretty sure that won't cause problems
later.

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

index 94e82d160b93523ac6c1c0fcff01a31705fd8062..862ff94e336525f5349774f5a9bbc809e51dc147 100644 (file)
@@ -6761,7 +6761,7 @@ void MDCache::snaprealm_create(MDRequest *mdr, CInode *in)
 }
 
 
-void MDCache::do_realm_invalidate_and_update_notify(CInode *in, int snapop)
+void MDCache::do_realm_invalidate_and_update_notify(CInode *in, int snapop, bool nosend)
 {
   dout(10) << "do_realm_invalidate_and_update_notify " << *in->snaprealm << " " << *in << dendl;
 
@@ -6797,7 +6797,7 @@ void MDCache::do_realm_invalidate_and_update_notify(CInode *in, int snapop)
         p != realm->client_caps.end();
         p++) {
       assert(!p->second.empty());
-      if (updates.count(p->first) == 0) {
+      if (!nosend && updates.count(p->first) == 0) {
        MClientSnap *update = new MClientSnap(snapop);
        update->head.split = in->ino();
        update->split_inos = split_inos;
@@ -6815,7 +6815,8 @@ void MDCache::do_realm_invalidate_and_update_notify(CInode *in, int snapop)
       q.push_back(*p);
   }
 
-  send_snaps(updates);
+  if (!nosend)
+    send_snaps(updates);
 }
 
 void MDCache::_snaprealm_create_finish(MDRequest *mdr, Mutation *mut, CInode *in)
index 09c52ae8dc3d6e110c17cb0f5b1b2edcf605911d..3bece87f4403a17312a0a0011e76322d5bafed82 100644 (file)
@@ -753,7 +753,7 @@ public:
   void process_reconnected_caps();
   void prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t ino,
                           map<client_t,MClientSnap*>& splits);
-  void do_realm_invalidate_and_update_notify(CInode *in, int snapop);
+  void do_realm_invalidate_and_update_notify(CInode *in, int snapop, bool nosend=false);
   void send_snaps(map<client_t,MClientSnap*>& splits);
   void rejoin_import_cap(CInode *in, client_t client, ceph_mds_cap_reconnect& icr, int frommds);
   void finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snapid_t seq);
index 272aa7134439336e3c3e030b127be34bd91c6312..3555bf7698c5f21a362b7a9a924cf572e6e6d1b1 100644 (file)
@@ -3835,7 +3835,7 @@ void Server::_unlink_local_finish(MDRequest *mdr,
     }
     straydnl->get_inode()->snaprealm->add_past_parent(oldparent);
     if (isnew)
-      mdcache->do_realm_invalidate_and_update_notify(straydnl->get_inode(), CEPH_SNAP_OP_SPLIT);
+      mdcache->do_realm_invalidate_and_update_notify(straydnl->get_inode(), CEPH_SNAP_OP_SPLIT, true);
 
     mdcache->touch_dentry_bottom(straydn);
   }