Skip to content

Commit

Permalink
ext4: fix error paths in swap_inode_boot_loader()
Browse files Browse the repository at this point in the history
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: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Dr. Tilmann Bubeck <t.bubeck@reinform.de>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org  # v3.10+
  • Loading branch information
Zheng Liu authored and Theodore Ts'o committed Feb 12, 2014
1 parent 15cc176 commit 30d29b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
handle = ext4_journal_start(inode_bl, EXT4_HT_MOVE_EXTENTS, 2);
if (IS_ERR(handle)) {
err = -EINVAL;
goto swap_boot_out;
goto journal_err_out;
}

/* Protect extent tree against block allocations via delalloc */
Expand Down Expand Up @@ -198,6 +198,7 @@ static long swap_inode_boot_loader(struct super_block *sb,

ext4_double_up_write_data_sem(inode, inode_bl);

journal_err_out:
ext4_inode_resume_unlocked_dio(inode);
ext4_inode_resume_unlocked_dio(inode_bl);

Expand Down

0 comments on commit 30d29b1

Please sign in to comment.