diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-11-27 10:06:18 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-27 11:38:33 -0500 |
commit | 4032daafaa9bddc71a517dbf592a6dbc8cb2ed0e (patch) | |
tree | 6280ab2b3801997dc57e4402a1b40c7510e2cf2c | |
parent | 3a2c4ac98642179c4eb8354cc13201a139a5c496 (diff) |
bcachefs: fix waiting on an open journal entry
-rw-r--r-- | fs/bcachefs/journal.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index ac1219fc6b66..47cfd50d444e 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -462,7 +462,7 @@ u64 bch2_journal_last_unwritten_seq(struct journal *j) 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); - bool need_reclaim = false; + int ret; retry: spin_lock(&j->lock); @@ -490,14 +490,11 @@ retry: BUG_ON(journal_cur_seq(j) < seq); - if (!journal_entry_open(j)) { - need_reclaim = true; - goto blocked; + ret = journal_entry_open(j); + if (ret) { + spin_unlock(&j->lock); + return ret < 0 ? ret : 0; } - - spin_unlock(&j->lock); - - return 0; blocked: if (!j->res_get_blocked_start) j->res_get_blocked_start = local_clock() ?: 1; @@ -505,8 +502,7 @@ blocked: closure_wait(&j->async_wait, cl); 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; } |