summaryrefslogtreecommitdiff
path: root/fs/jbd2
diff options
context:
space:
mode:
authorzhangyi (F) <yi.zhang@huawei.com>2020-06-20 09:19:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-26 11:30:59 +0300
commit402ff143b90b48c1d1b29127fa538a2d227c2161 (patch)
tree9ef91356210bf8bd71774fb1199d80c6cae0d905 /fs/jbd2
parenta5d3f789b272d76dadca4d35365a39ef516b31bf (diff)
downloadlinux-402ff143b90b48c1d1b29127fa538a2d227c2161.tar.xz
jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock()
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) <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>
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/journal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index a15a22d20909..8a50722bca29 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1370,8 +1370,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))