All of lore.kernel.org
 help / color / mirror / Atom feed
* mutex_unlock is missed in function (swap_inode_boot_loader) in file (linux-3.13/fs/ext4/ioctl.c)
@ 2014-02-05 19:39 Ahmed Tamrawi
  2014-02-09 12:27 ` [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader() (Re: mutex_unlock is missed ...) Zheng Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Tamrawi @ 2014-02-05 19:39 UTC (permalink / raw)
  To: linux-ext4

Hi there!

Bug Report Filed: https://bugzilla.kernel.org/show_bug.cgi?id=70091
Linux Version [3.13]
Configuration: Default configuration for x86


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).


Thanks,
Ahmed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader() (Re: mutex_unlock is missed ...)
  2014-02-05 19:39 mutex_unlock is missed in function (swap_inode_boot_loader) in file (linux-3.13/fs/ext4/ioctl.c) Ahmed Tamrawi
@ 2014-02-09 12:27 ` Zheng Liu
  2014-02-12 16:49   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Zheng Liu @ 2014-02-09 12:27 UTC (permalink / raw)
  To: Ahmed Tamrawi; +Cc: linux-ext4

Hi Ahmed,

On Wed, Feb 05, 2014 at 01:39:06PM -0600, Ahmed Tamrawi wrote:
> Hi there!
> 
> Bug Report Filed: https://bugzilla.kernel.org/show_bug.cgi?id=70091
> Linux Version [3.13]
> Configuration: Default configuration for x86
> 
> 
> 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).

Thanks for reporting this issue.  I believe the following patch that can
fix the issue.

Regards,
                                                - Zheng

Subject: [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader()

From: Zheng Liu <wenqing.lz@taobao.com>

In swap_inode_boot_loader() we forgot to release ->i_mutex and resume
unlocked dio for inode and inode_bl.  This commit fixes this issue.

Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Dr. Tilmann Bubeck <t.bubeck@reinform.de>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 fs/ext4/ioctl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 6bea806..a2a837f 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -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 */
@@ -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);
 
-- 
1.7.9.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader() (Re: mutex_unlock is missed ...)
  2014-02-09 12:27 ` [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader() (Re: mutex_unlock is missed ...) Zheng Liu
@ 2014-02-12 16:49   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2014-02-12 16:49 UTC (permalink / raw)
  To: Ahmed Tamrawi, linux-ext4

On Sun, Feb 09, 2014 at 08:27:45PM +0800, Zheng Liu wrote:
> 
> In swap_inode_boot_loader() we forgot to release ->i_mutex and resume
> unlocked dio for inode and inode_bl.  This commit fixes this issue.
> 
> Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
> Cc: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Dr. Tilmann Bubeck <t.bubeck@reinform.de>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-12 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-05 19:39 mutex_unlock is missed in function (swap_inode_boot_loader) in file (linux-3.13/fs/ext4/ioctl.c) Ahmed Tamrawi
2014-02-09 12:27 ` [PATCH] ext4: release ->i_mutex and resume unlocked dio in swap_inode_boot_loader() (Re: mutex_unlock is missed ...) Zheng Liu
2014-02-12 16:49   ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.