diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-03 12:57:00 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-21 13:07:10 -0700 |
commit | 4071d7a79585ee2768d0a63819d99405a083369f (patch) | |
tree | 7881175a2f9203fe93bfe3537cf09c70c6e285a7 | |
parent | 57a6a54db4020debd826a493cccca4695934f693 (diff) | |
download | ceph-4071d7a79585ee2768d0a63819d99405a083369f.tar.gz |
rgw: protect ops log socket formatter
Fixes: #4905
Ops log (through the unix domain socket) uses a formatter, which wasn't
protected.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit d48f1edb07a4d8727ac956f70e663c1b4e33e1dd)
-rw-r--r-- | src/rgw/rgw_log.cc | 4 | ||||
-rw-r--r-- | src/rgw/rgw_log.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 09fdacf4f2f..7fc3634d957 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -233,7 +233,7 @@ void OpsLogSocket::init_connection(bufferlist& bl) bl.append("["); } -OpsLogSocket::OpsLogSocket(CephContext *cct, uint64_t _backlog) : OutputDataSocket(cct, _backlog) +OpsLogSocket::OpsLogSocket(CephContext *cct, uint64_t _backlog) : OutputDataSocket(cct, _backlog), lock("OpsLogSocket") { formatter = new JSONFormatter; delim.append(",\n"); @@ -248,8 +248,10 @@ void OpsLogSocket::log(struct rgw_log_entry& entry) { bufferlist bl; + lock.Lock(); rgw_format_ops_log_entry(entry, formatter); formatter_to_bl(bl); + lock.Unlock(); append_output(bl); } diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index 823f0b1767f..37e387d4ce6 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -119,6 +119,7 @@ WRITE_CLASS_ENCODER(rgw_intent_log_entry) class OpsLogSocket : public OutputDataSocket { Formatter *formatter; + Mutex lock; void formatter_to_bl(bufferlist& bl); |