]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: fix waiting on an open journal entry
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 27 Nov 2018 15:06:18 +0000 (10:06 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:12 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c

index 4045c0e684627f0ac4482cfc1074952f3036d9d7..2f8dae4013af6b7495fed1624d8c2c0c98989f7b 100644 (file)
@@ -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)
 {
        struct bch_fs *c = container_of(j, struct bch_fs, journal);
-       bool need_reclaim = false;
+       int ret;
 retry:
        spin_lock(&j->lock);
 
@@ -489,14 +489,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;
@@ -504,8 +501,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;
 }