auth_pin(this);
int64_t pool;
- if (is_dir())
+ if (is_dir()) {
pool = mdcache->mds->mdsmap->get_metadata_pool();
- else
+ } else {
pool = inode.layout.fl_pg_pool;
+ }
inode_backtrace_t bt;
build_backtrace(pool, bt);
- bufferlist bl;
- ::encode(bt, bl);
+ bufferlist parent_bl;
+ ::encode(bt, parent_bl);
ObjectOperation op;
op.priority = op_prio;
op.create(false);
- op.setxattr("parent", bl);
+ op.setxattr("parent", parent_bl);
+
+ bufferlist layout_bl;
+ ::encode(inode.layout, layout_bl);
+ op.setxattr("layout", layout_bl);
SnapContext snapc;
object_t oid = get_object_name(ino(), frag_t(), "");
&mdcache->mds->finisher);
if (!state_test(STATE_DIRTYPOOL) || inode.old_pools.empty()) {
+ dout(20) << __func__ << ": no dirtypool or no old pools" << dendl;
mdcache->mds->objecter->mutate(oid, oloc, op, snapc, ceph_clock_now(g_ceph_context),
0, NULL, fin2);
return;
mdcache->mds->objecter->mutate(oid, oloc, op, snapc, ceph_clock_now(g_ceph_context),
0, NULL, gather.new_sub());
+ // In the case where DIRTYPOOL is set, we update all old pools backtraces
+ // such that anyone reading them will see the new pool ID in
+ // inode_backtrace_t::pool and go read everything else from there.
for (compact_set<int64_t>::iterator p = inode.old_pools.begin();
p != inode.old_pools.end();
++p) {
if (*p == pool)
continue;
+ dout(20) << __func__ << ": updating old pool " << *p << dendl;
+
ObjectOperation op;
op.priority = op_prio;
op.create(false);
- op.setxattr("parent", bl);
+ op.setxattr("parent", parent_bl);
object_locator_t oloc(*p);
mdcache->mds->objecter->mutate(oid, oloc, op, snapc, ceph_clock_now(g_ceph_context),