linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4]ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT
@ 2009-10-30  7:42 Akira Fujita
  2009-11-10 21:55 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Akira Fujita @ 2009-10-30  7:42 UTC (permalink / raw)
  To: Theodore Tso; +Cc: ext4 development

ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT

From: Akira Fujita <a-fujita@rs.jp.nec.com>

If kernel configuration related to lock debugging is enabled,
we get possible recursive locking warning.
Therefore, use down_write_nested() to guarantee
the lock order explicitly.

This problem has been reported by Brian Rogers before.
http://marc.info/?l=linux-ext4&m=125115356928011&w=1

Reported-by: Brian Rogers <brian@xyzw.org>
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
---
 fs/ext4/move_extent.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index a7410b3..2ca6aa3 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -189,7 +189,7 @@ double_down_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
 	}

 	down_write(&EXT4_I(first)->i_data_sem);
-	down_write(&EXT4_I(second)->i_data_sem);
+	down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
 }

 /**



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

* Re: [PATCH 3/4]ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT
  2009-10-30  7:42 [PATCH 3/4]ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT Akira Fujita
@ 2009-11-10 21:55 ` Theodore Tso
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2009-11-10 21:55 UTC (permalink / raw)
  To: Akira Fujita; +Cc: ext4 development

On Fri, Oct 30, 2009 at 04:42:01PM +0900, Akira Fujita wrote:
> ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT
> 
> From: Akira Fujita <a-fujita@rs.jp.nec.com>

Thanks, I've added this patch to the ext4 patch queue, but with the
following updated commit description:

ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT

From: Akira Fujita <a-fujita@rs.jp.nec.com>

If CONFIG_PROVE_LOCKING is enabled, the double_down_write_data_sem()
will trigger a false-positive warning of a recursive lock.  Since we
take i_data_sem for the two inodes ordered by their inode numbers,
this isn't a problem.  Use of down_write_nested() will notify the lock
dependency checker machinery that there is no problem here.

This problem was reported by Brian Rogers:

     http://marc.info/?l=linux-ext4&m=125115356928011&w=1

Reported-by: Brian Rogers <brian@xyzw.org>
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

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

end of thread, other threads:[~2009-11-10 21:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-30  7:42 [PATCH 3/4]ext4: Fix possible recursive locking warning in EXT4_IOC_MOVE_EXT Akira Fujita
2009-11-10 21:55 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).