mirror of
https://github.com/ceph/ceph
synced 2025-01-03 01:22:53 +00:00
mds: journal snaprealm changes in MDCache::journal_cow_dentry,
if a new snapnode exists. This means that you shouldn't journal them elsewhere if they go through journal_cow_dentry, so remove from mksnap and rmsnap!
This commit is contained in:
parent
481402a430
commit
35ea515892
@ -1360,7 +1360,10 @@ void MDCache::journal_cow_dentry(Mutation *mut, EMetaBlob *metablob, CDentry *dn
|
||||
*pcow_inode = oldin;
|
||||
CDentry *olddn = dn->dir->add_primary_dentry(dn->name, oldin, oldfirst, follows);
|
||||
dout(10) << " olddn " << *olddn << dendl;
|
||||
metablob->add_primary_dentry(olddn, true);
|
||||
bufferlist snapbl;
|
||||
if (dnl->get_inode()->projected_nodes.back()->snapnode)
|
||||
dnl->get_inode()->projected_nodes.back()->snapnode->encode(snapbl);
|
||||
metablob->add_primary_dentry(olddn, true, 0, 0, (snapbl.length() ? &snapbl : NULL));
|
||||
mut->add_cow_dentry(olddn);
|
||||
} else {
|
||||
assert(dnl->is_remote());
|
||||
|
@ -5722,12 +5722,10 @@ void Server::handle_client_mksnap(MDRequest *mdr)
|
||||
pi->version = diri->pre_dirty();
|
||||
|
||||
// project the snaprealm
|
||||
bufferlist snapbl;
|
||||
sr_t *newsnap = diri->project_snaprealm(snapid);
|
||||
newsnap->snaps[snapid] = info;
|
||||
newsnap->seq = snapid;
|
||||
newsnap->last_created = snapid;
|
||||
newsnap->encode(snapbl);
|
||||
|
||||
// journal the inode changes
|
||||
mdr->ls = mdlog->get_current_segment();
|
||||
@ -5739,8 +5737,6 @@ void Server::handle_client_mksnap(MDRequest *mdr)
|
||||
mdcache->predirty_journal_parents(mdr, &le->metablob, diri, 0, PREDIRTY_PRIMARY, false);
|
||||
mdcache->journal_cow_inode(mdr, &le->metablob, diri);
|
||||
// journal the snaprealm changes
|
||||
le->metablob.add_primary_dentry(diri->get_projected_parent_dn(), true, 0, 0, &snapbl);
|
||||
|
||||
mdlog->submit_entry(le, new C_MDS_mksnap_finish(mds, mdr, diri, info));
|
||||
mdlog->flush();
|
||||
}
|
||||
@ -5856,20 +5852,16 @@ void Server::handle_client_rmsnap(MDRequest *mdr)
|
||||
mdlog->start_entry(le);
|
||||
|
||||
// project the snaprealm
|
||||
bufferlist snapbl;
|
||||
sr_t *newnode = diri->project_snaprealm();
|
||||
newnode->snaps.erase(snapid);
|
||||
newnode->seq = seq;
|
||||
newnode->last_destroyed = seq;
|
||||
newnode->encode(snapbl);
|
||||
|
||||
le->metablob.add_client_req(req->get_reqid(), req->get_oldest_client_tid());
|
||||
le->metablob.add_table_transaction(TABLE_SNAP, stid);
|
||||
mdcache->predirty_journal_parents(mdr, &le->metablob, diri, 0, PREDIRTY_PRIMARY, false);
|
||||
mdcache->journal_cow_inode(mdr, &le->metablob, diri);
|
||||
|
||||
le->metablob.add_primary_dentry(diri->get_projected_parent_dn(), true, 0, 0, &snapbl);
|
||||
|
||||
mdlog->submit_entry(le, new C_MDS_rmsnap_finish(mds, mdr, diri, snapid));
|
||||
mdlog->flush();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user