journal: reset the offline state if blocking signals fails
journal_file_set_offline() sets OFFLINE_SYNCING before it starts the offline thread. If the first pthread_sigmask() fails, it returns without starting the thread and leaves the state at OFFLINE_SYNCING. The next journal_file_set_offline_thread_join() then calls pthread_join() on a thread that was never created. Set OFFLINE_JOINED, as the error path of pthread_create() does. (cherry picked from commit db2b225a30da26d0939f1f6d6c4b524bd2240900)
This commit is contained in:
committed by
Luca Boccassi
parent
e5197414d9
commit
fcaf217ab2
@@ -377,8 +377,10 @@ int journal_file_set_offline(JournalFile *f, bool wait) {
|
||||
assert_se(sigdelset(&ss, SIGBUS) >= 0);
|
||||
|
||||
r = pthread_sigmask(SIG_BLOCK, &ss, &saved_ss);
|
||||
if (r > 0)
|
||||
if (r > 0) {
|
||||
f->offline_state = OFFLINE_JOINED;
|
||||
return -r;
|
||||
}
|
||||
|
||||
r = pthread_create(&f->offline_thread, NULL, journal_file_set_offline_thread, f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user