messages/MOSDOp: avoid uninit/undecoded fields in print()

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2015-10-03 13:09:04 -04:00
parent d1e6976289
commit 8e930e3d2f

View File

@ -444,37 +444,29 @@ struct ceph_osd_request_head {
const char *get_type_name() const { return "osd_op"; } const char *get_type_name() const { return "osd_op"; }
void print(ostream& out) const { void print(ostream& out) const {
if (!partial_decode_needed) out << "osd_op(";
out << "osd_op(" << get_reqid(); if (!partial_decode_needed) {
out << " "; out << get_reqid() << ' ';
if (!oloc.nspace.empty()) out << pgid;
out << oloc.nspace << "/"; if (!final_decode_needed) {
out << oid; out << ' ';
if (!oloc.nspace.empty())
#if 0 out << oloc.nspace << "/";
out << " "; out << oid
if (may_read()) << " " << ops
out << "r"; << " snapc " << get_snap_seq() << "=" << snaps;
if (may_write()) if (oloc.key.size())
out << "w"; out << " " << oloc;
#endif if (is_retry_attempt())
if (snapid != CEPH_NOSNAP) out << " RETRY=" << get_retry_attempt();
out << "@" << snapid; } else {
out << " (undecoded)";
if (oloc.key.size()) }
out << " " << oloc;
out << " " << ops;
out << " " << pgid;
if (is_retry_attempt())
out << " RETRY=" << get_retry_attempt();
if (reassert_version != eversion_t())
out << " reassert_version=" << reassert_version;
if (!final_decode_needed)
out << " snapc " << get_snap_seq() << "=" << snaps;
if (!partial_decode_needed)
out << " " << ceph_osd_flag_string(get_flags()); out << " " << ceph_osd_flag_string(get_flags());
out << " e" << osdmap_epoch; if (reassert_version != eversion_t())
out << " reassert_version=" << reassert_version;
out << " e" << osdmap_epoch;
}
out << ")"; out << ")";
} }
}; };