diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-27 21:23:46 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-02 02:11:08 +0100 |
commit | be9e782df3cb557715630a61dc79d9f966737859 (patch) | |
tree | 68c77fe233bb9de8c3b3d9140e64e0ea152dfead /fs/bcachefs/btree_trans_commit.c | |
parent | bcachefs: Fix deleted inodes btree in snapshot deletion (diff) | |
download | linux-be9e782df3cb557715630a61dc79d9f966737859.tar.xz linux-be9e782df3cb557715630a61dc79d9f966737859.zip |
bcachefs: Don't downgrade locks on transaction restart
We should only be downgrading locks on success - otherwise, our
transaction restarts won't be getting the correct locks and we'll
livelock.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_trans_commit.c')
-rw-r--r-- | fs/bcachefs/btree_trans_commit.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c index 53ddcaf042a2..8140b6e6e9a6 100644 --- a/fs/bcachefs/btree_trans_commit.c +++ b/fs/bcachefs/btree_trans_commit.c @@ -861,12 +861,7 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags */ bch2_journal_res_put(&c->journal, &trans->journal_res); - if (unlikely(ret)) - return ret; - - bch2_trans_downgrade(trans); - - return 0; + return ret; } static int journal_reclaim_wait_done(struct bch_fs *c) @@ -1135,6 +1130,8 @@ out: if (likely(!(flags & BTREE_INSERT_NOCHECK_RW))) bch2_write_ref_put(c, BCH_WRITE_REF_trans); out_reset: + if (!ret) + bch2_trans_downgrade(trans); bch2_trans_reset_updates(trans); return ret; |