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.
This commit is contained in:
Sage Weil 2010-04-23 11:07:16 -07:00
parent 7a8daedf00
commit 609eaa14ca
3 changed files with 6 additions and 5 deletions

View 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)

View 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);

View 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);
}