Skip to content

Commit

Permalink
jbd2: add the missing unlock_buffer() in the error path of jbd2_write…
Browse files Browse the repository at this point in the history
…_superblock()

commit ef3f583 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: 742b06b ("jbd2: check superblock mapped prior to committing")
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20200620061948.2049579-1-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
zhangyi089 authored and gregkh committed Aug 26, 2020
1 parent 2bc54ba commit b4062a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,8 +1348,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))
Expand Down

0 comments on commit b4062a4

Please sign in to comment.