Skip to content

Commit 021186d

Browse files
authored
Merge pull request ceph#61677 from ljflores/wip-revert-pr-60176
Revert PR 60176
2 parents 967325f + bc03c5b commit 021186d

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/msg/async/ProtocolV1.cc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void ProtocolV1::send_message(Message *m) {
222222
is_prepared = true;
223223
}
224224

225-
std::unique_lock l{connection->write_lock};
225+
std::lock_guard<std::mutex> l(connection->write_lock);
226226
// "features" changes will change the payload encoding
227227
if (can_fast_prepare &&
228228
(can_write == WriteStatus::NOWRITE || connection->get_features() != f)) {
@@ -245,11 +245,6 @@ void ProtocolV1::send_message(Message *m) {
245245
<< dendl;
246246
if (can_write != WriteStatus::REPLACING && !write_in_progress) {
247247
write_in_progress = true;
248-
249-
/* unlock the mutex now because dispatch_event_external() may
250-
block waiting for another mutex */
251-
l.unlock();
252-
253248
connection->center->dispatch_event_external(connection->write_handler);
254249
}
255250
}
@@ -275,14 +270,9 @@ void ProtocolV1::prepare_send_message(uint64_t features, Message *m,
275270

276271
void ProtocolV1::send_keepalive() {
277272
ldout(cct, 10) << __func__ << dendl;
278-
std::unique_lock l{connection->write_lock};
273+
std::lock_guard<std::mutex> l(connection->write_lock);
279274
if (can_write != WriteStatus::CLOSED) {
280275
keepalive = true;
281-
282-
/* unlock the mutex now because dispatch_event_external() may
283-
block waiting for another mutex */
284-
l.unlock();
285-
286276
connection->center->dispatch_event_external(connection->write_handler);
287277
}
288278
}

src/msg/async/ProtocolV2.cc

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ void ProtocolV2::send_message(Message *m) {
440440
is_prepared = false;
441441
}
442442

443-
std::unique_lock l{connection->write_lock};
443+
std::lock_guard<std::mutex> l(connection->write_lock);
444444
// "features" changes will change the payload encoding
445445
if (can_fast_prepare && (!can_write || connection->get_features() != f)) {
446446
// ensure the correctness of message encoding
@@ -464,26 +464,16 @@ void ProtocolV2::send_message(Message *m) {
464464
<< dendl;
465465
if (((!replacing && can_write) || state == STANDBY) && !write_in_progress) {
466466
write_in_progress = true;
467-
468-
/* unlock the mutex now because dispatch_event_external() may
469-
block waiting for another mutex */
470-
l.unlock();
471-
472467
connection->center->dispatch_event_external(connection->write_handler);
473468
}
474469
}
475470
}
476471

477472
void ProtocolV2::send_keepalive() {
478473
ldout(cct, 10) << __func__ << dendl;
479-
std::unique_lock l{connection->write_lock};
474+
std::lock_guard<std::mutex> l(connection->write_lock);
480475
if (state != CLOSED) {
481476
keepalive = true;
482-
483-
/* unlock the mutex now because dispatch_event_external() may
484-
block waiting for another mutex */
485-
l.unlock();
486-
487477
connection->center->dispatch_event_external(connection->write_handler);
488478
}
489479
}
@@ -1653,8 +1643,8 @@ CtPtr ProtocolV2::handle_keepalive2(ceph::bufferlist &payload)
16531643

16541644
ldout(cct, 30) << __func__ << " got KEEPALIVE2 tag ..." << dendl;
16551645

1656-
auto keepalive_ack_frame = KeepAliveFrameAck::Encode(keepalive_frame.timestamp());
16571646
connection->write_lock.lock();
1647+
auto keepalive_ack_frame = KeepAliveFrameAck::Encode(keepalive_frame.timestamp());
16581648
if (!append_frame(keepalive_ack_frame)) {
16591649
connection->write_lock.unlock();
16601650
return _fault();

0 commit comments

Comments
 (0)