linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()
@ 2020-06-20  6:19 zhangyi (F)
  2020-07-08 11:03 ` Ritesh Harjani
  2020-08-06  4:16 ` tytso
  0 siblings, 2 replies; 3+ messages in thread
From: zhangyi (F) @ 2020-06-20  6:19 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, jack, yi.zhang, jiufei.xue

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")
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Cc: stable@kernel.org
---
 fs/jbd2/journal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index a49d0e670ddf..55c4ec4edf96 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1366,8 +1366,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))
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()
  2020-06-20  6:19 [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() zhangyi (F)
@ 2020-07-08 11:03 ` Ritesh Harjani
  2020-08-06  4:16 ` tytso
  1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2020-07-08 11:03 UTC (permalink / raw)
  To: zhangyi (F), linux-ext4; +Cc: tytso, jack, jiufei.xue



On 6/20/20 11:49 AM, zhangyi (F) wrote:
> 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")
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
> Cc: stable@kernel.org

LGTM, feel free to add
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>


> ---
>   fs/jbd2/journal.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index a49d0e670ddf..55c4ec4edf96 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1366,8 +1366,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))
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()
  2020-06-20  6:19 [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() zhangyi (F)
  2020-07-08 11:03 ` Ritesh Harjani
@ 2020-08-06  4:16 ` tytso
  1 sibling, 0 replies; 3+ messages in thread
From: tytso @ 2020-08-06  4:16 UTC (permalink / raw)
  To: zhangyi (F); +Cc: linux-ext4, jack, jiufei.xue

On Sat, Jun 20, 2020 at 02:19:48PM +0800, zhangyi (F) wrote:
> 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")
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
> Cc: stable@kernel.org

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-06 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20  6:19 [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() zhangyi (F)
2020-07-08 11:03 ` Ritesh Harjani
2020-08-06  4:16 ` tytso

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 NNTP newsgroup(s).