Bug 70091

Summary: mutex_unlock is missed in function (swap_inode_boot_loader) in file (linux-3.13/fs/ext4/ioctl.c)
Product: File System Reporter: Ahmed Tamrawi (atamrawi)
Component: ext4Assignee: fs_ext4 (fs_ext4)
Status: RESOLVED CODE_FIX    
Severity: normal CC: cse.cem, tytso
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.13 Subsystem:
Regression: No Bisected commit-id:

Description Ahmed Tamrawi 2014-02-05 19:36:43 UTC
In function (swap_inode_boot_loader) in file (linux-3.13/fs/ext4/ioctl.c):

The structures: (inode->i_mutex) and (inode_bl->i_mutex) gets successfully locked at line (133) by (lock_two_nondirectories(inode, inode_bl), but both are not unlocked when the function returns after line (147), however they got unlocked only at line (208) by (unlock_two_nondirectories(inode, inode_bl)).

A possible solution is to call (unlock_two_nondirectories(inode, inode_bl)) before line (147).
Comment 1 Conrad Meyer 2014-03-30 19:51:52 UTC
This was fixed in 30d29b119ef01776e0a301444ab24defe8d8bef3

Author: Zheng Liu <wenqing.lz@taobao.com>
Date:   Wed Feb 12 11:48:31 2014 -0500

    ext4: fix error paths in swap_inode_boot_loader()

    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.

In merge commit 805937cf45f9a9933e6b8e5c6660406e977a9a23

Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Tue Feb 18 10:04:09 2014 -0800

    Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

    ...
Comment 2 Theodore Tso 2014-03-31 20:39:39 UTC
Thanks for the note!