Skip to contentSkip to conversation

FAILED: patch "[PATCH] jbd2: add the missing unlock_buffer() in the error path of" failed to apply to 4.4-stable tree

PATCH [email protected] 1 participant 1 message Aug 23, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ef3f5830b859604eda8723c26d90ab23edc027a4 Mon Sep 17 00:00:00 2001
From: "zhangyi (F)" <[email protected]>
Date: Sat, 20 Jun 2020 14:19:48 +0800
Subject: [PATCH] jbd2: add the missing unlock_buffer() in the error path of
jbd2_write_superblock()

jbd2_write_superblock() is under the buffer lock of journal superblock before ending that superblock write, so add a missing unlock_buffer() in in the error path before submitting buffer.

Fixes 742b06b5628f ("jbd2: check superblock mapped prior to committing")
fs/jbd2/journal.c +3 -1
index e4944436e733..5493a0da23dd 100644
@@ -1367,8 +1367,10 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
 	int ret;
 
 	/* Buffer got discarded which means block device got invalidated */
-	if (!buffer_mapped(bh))
+	if (!buffer_mapped(bh)) {
+		unlock_buffer(bh);
 		return -EIO;
+	}
 
 	trace_jbd2_write_superblock(journal, write_flags);
 	if (!(journal->j_flags & JBD2_BARRIER))