Commit 9d11058a authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: fix waiting on an open journal entry

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent d034c09b
...@@ -461,7 +461,7 @@ u64 bch2_journal_last_unwritten_seq(struct journal *j) ...@@ -461,7 +461,7 @@ u64 bch2_journal_last_unwritten_seq(struct journal *j)
int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl) int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl)
{ {
struct bch_fs *c = container_of(j, struct bch_fs, journal); struct bch_fs *c = container_of(j, struct bch_fs, journal);
bool need_reclaim = false; int ret;
retry: retry:
spin_lock(&j->lock); spin_lock(&j->lock);
...@@ -489,14 +489,11 @@ int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl) ...@@ -489,14 +489,11 @@ int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl)
BUG_ON(journal_cur_seq(j) < seq); BUG_ON(journal_cur_seq(j) < seq);
if (!journal_entry_open(j)) { ret = journal_entry_open(j);
need_reclaim = true; if (ret) {
goto blocked; spin_unlock(&j->lock);
return ret < 0 ? ret : 0;
} }
spin_unlock(&j->lock);
return 0;
blocked: blocked:
if (!j->res_get_blocked_start) if (!j->res_get_blocked_start)
j->res_get_blocked_start = local_clock() ?: 1; j->res_get_blocked_start = local_clock() ?: 1;
...@@ -504,8 +501,7 @@ int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl) ...@@ -504,8 +501,7 @@ int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl)
closure_wait(&j->async_wait, cl); closure_wait(&j->async_wait, cl);
spin_unlock(&j->lock); spin_unlock(&j->lock);
if (need_reclaim) bch2_journal_reclaim_work(&j->reclaim_work.work);
bch2_journal_reclaim_work(&j->reclaim_work.work);
return -EAGAIN; return -EAGAIN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment