Commit 4687eb1e authored by Zheng Liu's avatar Zheng Liu Committed by Greg Kroah-Hartman

ext4: fix error paths in swap_inode_boot_loader()

commit 30d29b11 upstream.

In swap_inode_boot_loader() we forgot to release ->i_mutex and resume
unlocked dio for inode and inode_bl if there is an error starting the
journal handle.  This commit fixes this issue.
Reported-by: default avatarAhmed Tamrawi <ahmedtamrawi@gmail.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Dr. Tilmann Bubeck <t.bubeck@reinform.de>
Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b85dac35
...@@ -145,7 +145,7 @@ static long swap_inode_boot_loader(struct super_block *sb, ...@@ -145,7 +145,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
handle = ext4_journal_start(inode_bl, EXT4_HT_MOVE_EXTENTS, 2); handle = ext4_journal_start(inode_bl, EXT4_HT_MOVE_EXTENTS, 2);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
err = -EINVAL; err = -EINVAL;
goto swap_boot_out; goto journal_err_out;
} }
/* Protect extent tree against block allocations via delalloc */ /* Protect extent tree against block allocations via delalloc */
...@@ -203,6 +203,7 @@ static long swap_inode_boot_loader(struct super_block *sb, ...@@ -203,6 +203,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
ext4_double_up_write_data_sem(inode, inode_bl); ext4_double_up_write_data_sem(inode, inode_bl);
journal_err_out:
ext4_inode_resume_unlocked_dio(inode); ext4_inode_resume_unlocked_dio(inode);
ext4_inode_resume_unlocked_dio(inode_bl); ext4_inode_resume_unlocked_dio(inode_bl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment