From: Sage Weil Date: Fri, 7 Aug 2015 14:49:26 +0000 (-0400) Subject: osd/ReplicatedPG: fix filter lifecycle in do_osd_ops X-Git-Tag: v9.1.0~346^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2fc74d18a5e65b4a5b30d760550935a174613e8;p=ceph.git osd/ReplicatedPG: fix filter lifecycle in do_osd_ops If we take an error path in [N]PGLS (objects_list_partial error or bad handle) and FAILOK is set we may exec a second filter op that reallocates a new filter without freeing the old one. Simplify by freeing only at the end of the function or when a new filter is (re)allocated. Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index e810d48d23e..4f550acfc06 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -799,6 +799,10 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) result = -EINVAL; break; } + if (filter) { + delete filter; + filter = NULL; + } result = get_pgls_filter(bp, &filter); if (result < 0) break; @@ -942,8 +946,6 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) dout(10) << " pgnls result=" << result << " outdata.length()=" << osd_op.outdata.length() << dendl; } - delete filter; - filter = NULL; break; case CEPH_OSD_OP_PGLS_FILTER: @@ -956,6 +958,10 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) result = -EINVAL; break; } + if (filter) { + delete filter; + filter = NULL; + } result = get_pgls_filter(bp, &filter); if (result < 0) break; @@ -1091,8 +1097,6 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) dout(10) << " pgls result=" << result << " outdata.length()=" << osd_op.outdata.length() << dendl; } - delete filter; - filter = NULL; break; case CEPH_OSD_OP_PG_HITSET_LS: