mirror of
https://github.com/ceph/ceph
synced 2024-12-24 12:24:19 +00:00
osd/ReplicatedPG: fix undirty on clean object
Return success, but do not screw up the stats. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
c561d5ea22
commit
bc893f55d8
src
@ -2885,9 +2885,12 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
|
||||
case CEPH_OSD_OP_UNDIRTY:
|
||||
++ctx->num_write;
|
||||
{
|
||||
ctx->undirty = true; // see make_writeable()
|
||||
ctx->modify = true;
|
||||
ctx->delta_stats.num_wr++;
|
||||
if (oi.is_dirty()) {
|
||||
ctx->undirty = true; // see make_writeable()
|
||||
ctx->modify = true;
|
||||
ctx->delta_stats.num_wr++;
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4161,6 +4164,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
|
||||
// we will mark the object dirty
|
||||
if (ctx->undirty) {
|
||||
dout(20) << " clearing DIRTY flag" << dendl;
|
||||
assert(ctx->new_obs.oi.is_dirty());
|
||||
ctx->new_obs.oi.clear_flag(object_info_t::FLAG_DIRTY);
|
||||
--ctx->delta_stats.num_objects_dirty;
|
||||
} else if (!ctx->new_obs.oi.test_flag(object_info_t::FLAG_DIRTY)) {
|
||||
|
@ -61,6 +61,11 @@ TEST(LibRadosTier, Dirty) {
|
||||
op.undirty();
|
||||
ASSERT_EQ(0, ioctx.operate("foo", &op));
|
||||
}
|
||||
{
|
||||
ObjectWriteOperation op;
|
||||
op.undirty();
|
||||
ASSERT_EQ(0, ioctx.operate("foo", &op)); // still 0 if already clean
|
||||
}
|
||||
{
|
||||
bool dirty = false;
|
||||
int r = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user