Stable Archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <dominique.martinet@atmark-techno.com>
To: gregkh@linuxfoundation.org
Cc: stable@vger.kernel.org, dsterba@suse.com, pavel@denx.de,
	Dominique Martinet <dominique.martinet@atmark-techno.com>
Subject: [PATCH 5.10 / 5.4 / 4.19] btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks()
Date: Tue, 14 May 2024 08:06:49 +0900	[thread overview]
Message-ID: <20240513230649.1060173-1-dominique.martinet@atmark-techno.com> (raw)
In-Reply-To: <2024051346-unvocal-magnetism-4ae1@gregkh>

[ Upstream commit 9af503d91298c3f2945e73703f0e00995be08c30 ]

The previous patch that replaced BUG_ON by error handling forgot to
unlock the mutex in the error path.

Link: https://lore.kernel.org/all/Zh%2fHpAGFqa7YAFuM@duo.ucw.cz
Reported-by: Pavel Machek <pavel@denx.de>
Fixes: 7411055db5ce ("btrfs: handle chunk tree lookup error in btrfs_relocate_sys_chunks()")
Cc: stable@vger.kernel.org
Reviewed-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
The conflict is in 7411055db5ce ("btrfs: handle chunk tree lookup error
in btrfs_relocate_sys_chunks()") but that no longer cleanly applies
after the backport of 7411055db5ce ("btrfs: handle chunk tree lookup
error in btrfs_relocate_sys_chunks()"); it's probably simpler to just
use the old mutex name directly.

This commit applies and builds on 4.19.313, 5.4.275 and 5.10.216

 fs/btrfs/volumes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 09c23626feba..2d3aeef01c9e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3187,6 +3187,7 @@ static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info)
 			 * alignment and size).
 			 */
 			ret = -EUCLEAN;
+			mutex_unlock(&fs_info->delete_unused_bgs_mutex);
 			goto error;
 		}
 
-- 
2.39.2



  reply	other threads:[~2024-05-13 23:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 13:36 FAILED: patch "[PATCH] btrfs: add missing mutex_unlock in" failed to apply to 5.10-stable tree gregkh
2024-05-13 23:06 ` Dominique Martinet [this message]
2024-05-23 12:04   ` [PATCH 5.10 / 5.4 / 4.19] btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240513230649.1060173-1-dominique.martinet@atmark-techno.com \
    --to=dominique.martinet@atmark-techno.com \
    --cc=dsterba@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=pavel@denx.de \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).