From: Kent Overstreet <kent.overstreet@gmail.com>
Date: Wed, 28 Jul 2021 20:17:10 +0000 (-0400)
Subject: bcachefs: Change lockrestart_do() to always call bch2_trans_begin()
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3cc5288a62f2657b99faab428f993673ca9d033f;p=linux.git

bcachefs: Change lockrestart_do() to always call bch2_trans_begin()

More consistent behaviour means less likely to trip over ourselves in
silly ways.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---

diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index b5f35a419004..a1f2d9822821 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -110,12 +110,10 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
 ({									\
 	int _ret;							\
 									\
-	while (1) {							\
-		_ret = (_do);						\
-		if (_ret != -EINTR)					\
-			break;						\
+	do {								\
 		bch2_trans_begin(_trans);				\
-	}								\
+		_ret = (_do);						\
+	} while (_ret == -EINTR);					\
 									\
 	_ret;								\
 })