SIGN IN SIGN UP

os/bluestore: wait out log compaction before reserving BlueFS log seqs

_extend_log() waits out log_forbidden_to_expand after its caller has
already advanced/reserved log seqs. The wait releases log.lock, so a
concurrent flusher can enter and trip the log.t.seq == log.seq_live
assert in _log_advance_seq(); without that assert it would flush the
shared log.t under later seqs and the parked seqs would be appended
out of order, which replay silently treats as end-of-log.

Restore the wait-before-reservation design of 08cf6d04a19
("os/bluestore/bluefs: Split single bluefs lock into multiple smaller
locks"): _flush_and_sync_log_LD() composes log.t first and, only when
the transaction needs to extend the log while expansion is forbidden,
parks on log_cond with no seq reserved, re-evaluating from scratch on
wakeup - re-consuming is safe because already-consumed files re-encode
as empty deltas. _extend_log()'s wait becomes an assert: the flag is
only set under log.lock, which the caller now holds from the check
onward. Flushers that fit the runway never wait, so flush vs async
compaction concurrency is unchanged.

_flush_and_sync_log_LD() now holds log.lock through a single
unique_lock: the wait uses the predicate form of
condition_variable::wait(), and the early return and the post-flush
release fall out of RAII instead of explicit unlock calls.

Fixes: e97aa857c241 ("os/bluestore: fix bluefs log runway enospc")
Signed-off-by: Ming Lei <ming.lei@clyso.com>
M
Ming Lei committed
adf114183c13246a0e56937d33e773f68fe8dbfc
Parent: 2499b4a