From f3617e5105ac80f67652e1bfc1784da76a1572fd Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Jun 2011 13:02:58 -0700 Subject: [PATCH] osd: fix head_exists fix Needs to default to false, or else deletions don't work. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 72fca063a18e9..8ee3723320970 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1027,7 +1027,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, ObjectState& obs = ctx->new_obs; object_info_t& oi = obs.oi; - bool exists = obs.exists; + bool maybe_created = false; const sobject_t& soid = oi.soid; @@ -1420,7 +1420,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, } info.stats.num_wr++; info.stats.num_wr_kb += SHIFT_ROUND_UP(op.extent.length, 10); - exists = true; + maybe_created = true; } break; @@ -1431,7 +1431,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, if (obs.exists) t.truncate(coll, soid, 0); else - exists = true; + maybe_created = true; t.write(coll, soid, op.extent.offset, op.extent.length, nbl); if (ssc->snapset.clones.size()) { snapid_t newest = *ssc->snapset.clones.rbegin(); @@ -1484,7 +1484,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, result = -EEXIST; /* this is an exclusive create */ else { t.touch(coll, soid); - exists = true; + maybe_created = true; } } break; @@ -1594,7 +1594,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, { if (!obs.exists) { t.touch(coll, soid); - exists = true; + maybe_created = true; } string aname; bp.copy(op.xattr.name_len, aname); @@ -1906,7 +1906,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, result = -EOPNOTSUPP; } - if (!obs.exists && exists) { + if (!obs.exists && maybe_created) { dout(20) << " num_objects " << info.stats.num_objects << " -> " << (info.stats.num_objects+1) << dendl; info.stats.num_objects++; obs.exists = true; -- 2.39.5