Skip to content

Commit

Permalink
mds: skip client snap notification on unlink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
liewegas committed Apr 23, 2010
1 parent 7a8daed commit 609eaa1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class MDCache {
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);
Expand Down
2 changes: 1 addition & 1 deletion src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 609eaa1

Please sign in to comment.