]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
authorFilipe Manana <fdmanana@suse.com>
Wed, 26 Jul 2023 15:56:57 +0000 (16:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:28:06 +0000 (12:28 +0200)
commit91f6a538d625d360400eb03ce4d65297c695302c
tree90f8dbc61ef266a586ed4867e2666817a3ab8348
parentf933a1c43b68103c4deaf2e4289fc1e65428d8b4
btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART

commit 4490e803e1fe9fab8db5025e44e23b55df54078b upstream.

When joining a transaction with TRANS_JOIN_NOSTART, if we don't find a
running transaction we end up creating one. This goes against the purpose
of TRANS_JOIN_NOSTART which is to join a running transaction if its state
is at or below the state TRANS_STATE_COMMIT_START, otherwise return an
-ENOENT error and don't start a new transaction. So fix this to not create
a new transaction if there's no running transaction at or below that
state.

CC: stable@vger.kernel.org # 4.14+
Fixes: a6d155d2e363 ("Btrfs: fix deadlock between fiemap and transaction commits")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/transaction.c