]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Fix an assertion
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 3 Jan 2022 03:24:43 +0000 (22:24 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:21 +0000 (17:09 -0400)
bch2_trans_commit() can legitimately return -ENOSPC with
BTREE_INSERT_NOFAIL set if BTREE_INSERT_NOWAIT was also set.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_update_leaf.c

index 1072acb0c9afcf2ad6592bdbcae10fb02b16df12..60897fc70c58ecad747b5371c1df805d1e30a1dc 100644 (file)
@@ -816,7 +816,9 @@ int bch2_trans_commit_error(struct btree_trans *trans,
        }
 
        BUG_ON((ret == EINTR || ret == -EAGAIN) && !trans->restarted);
-       BUG_ON(ret == -ENOSPC && (trans->flags & BTREE_INSERT_NOFAIL));
+       BUG_ON(ret == -ENOSPC &&
+              !(trans->flags & BTREE_INSERT_NOWAIT) &&
+              (trans->flags & BTREE_INSERT_NOFAIL));
 
        return ret;
 }