2020-08-24 08:52:28

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.9 15/39] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()

From: zhangyi (F) <[email protected]>

commit ef3f5830b859604eda8723c26d90ab23edc027a4 upstream.

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) <[email protected]>
Reviewed-by: Ritesh Harjani <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/jbd2/journal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1340,8 +1340,10 @@ static int jbd2_write_superblock(journal
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))



2020-08-24 11:19:12

by Zhang Yi

[permalink] [raw]
Subject: Re: [PATCH 4.9 15/39] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()

Hi,Greg

The problem this patch want to fix only exists on the kernel both
538bcaa6261b and 742b06b5628f these two upstream patches were merged,
but 538bcaa6261b was not merged to 4.9, so we don't need this patch
for 4.9.

Thanks,
Yi.

On 2020/8/24 16:31, Greg Kroah-Hartman wrote:
> From: zhangyi (F) <[email protected]>
>
> commit ef3f5830b859604eda8723c26d90ab23edc027a4 upstream.
>
> 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) <[email protected]>
> Reviewed-by: Ritesh Harjani <[email protected]>
> Cc: [email protected]
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Theodore Ts'o <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> ---
> fs/jbd2/journal.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1340,8 +1340,10 @@ static int jbd2_write_superblock(journal
> 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))
>
>
>
> .
>

2020-08-24 15:47:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4.9 15/39] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()

On Mon, Aug 24, 2020 at 07:15:25PM +0800, zhangyi (F) wrote:
> Hi,Greg
>
> The problem this patch want to fix only exists on the kernel both
> 538bcaa6261b and 742b06b5628f these two upstream patches were merged,
> but 538bcaa6261b was not merged to 4.9, so we don't need this patch
> for 4.9.

Ok, thanks, but that wasn't obvious at all :)

I'll go drop this from 4.9.y now...

greg k-h