From: Sage Weil Date: Fri, 23 Apr 2010 18:07:16 +0000 (-0700) Subject: mds: skip client snap notification on unlink X-Git-Tag: v0.20~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=609eaa14ca660a9b8b965f5713921ce4be5c80be;p=ceph.git mds: skip client snap notification on unlink 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. --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 94e82d160b93..862ff94e3365 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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) diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 09c52ae8dc3d..3bece87f4403 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -753,7 +753,7 @@ public: void process_reconnected_caps(); void prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t ino, map& 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& 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); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 272aa7134439..3555bf7698c5 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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); }