Frederic Weisbecker
c674905ca7
reiserfs: Fix unwanted recursive reiserfs lock in reiserfs_unlink()
reiserfs_unlink() may or may not be called under the reiserfs
lock.
But it also takes the reiserfs lock and can then acquire it
recursively which leads to do_journal_begin_r() that fails to
relax the reiserfs lock before grabbing the journal mutex,
creating an unexpected lock inversion.
We need to ensure reiserfs_unlink() won't get the reiserfs lock
recursively using reiserfs_write_lock_once().
This fixes the following warning that precedes a lock inversion
report (reiserfs lock <-> journal mutex).
------------[ cut here ]------------
WARNING: at fs/reiserfs/lock.c:95 reiserfs_lock_check_recursive+0x3a/0x50()
Hardware name: MS-7418
Unwanted recursive reiserfs lock!
Pid: 3208, comm: dbench Not tainted 2.6.32-atom #177
Call Trace:
[<c114327a>] ? reiserfs_lock_check_recursive+0x3a/0x50
[<c114327a>] ? reiserfs_lock_check_recursive+0x3a/0x50
[<c10373a7>] warn_slowpath_common+0x67/0xc0
[<c114327a>] ? reiserfs_lock_check_recursive+0x3a/0x50
[<c1037446>] warn_slowpath_fmt+0x26/0x30
[<c114327a>] reiserfs_lock_check_recursive+0x3a/0x50
[<c113c213>] do_journal_begin_r+0x83/0x360
[<c105eb16>] ? __lock_acquire+0x1296/0x19e0
[<c1142a57>] ? xattr_unlink+0x57/0xb0
[<c113c670>] journal_begin+0x80/0x130
[<c1116d5d>] reiserfs_unlink+0x7d/0x2d0
[<c1142a57>] ? xattr_unlink+0x57/0xb0
[<c1142a57>] ? xattr_unlink+0x57/0xb0
[<c1142a57>] ? xattr_unlink+0x57/0xb0
[<c1142a64>] xattr_unlink+0x64/0xb0
[<c1143169>] delete_one_xattr+0x29/0x100
[<c11427ab>] reiserfs_for_each_xattr+0x10b/0x290
[<c1143140>] ? delete_one_xattr+0x0/0x100
[<c1401ca9>] ? mutex_lock_nested+0x299/0x340
[<c11429aa>] reiserfs_delete_xattrs+0x1a/0x60
[<c11432f9>] ? reiserfs_write_lock_once+0x29/0x50
[<c111ea1f>] reiserfs_delete_inode+0x9f/0x150
[<c11b0d0f>] ? _atomic_dec_and_lock+0x4f/0x70
[<c111e980>] ? reiserfs_delete_inode+0x0/0x150
[<c10c9c32>] generic_delete_inode+0xa2/0x170
[<c10c9d4f>] generic_drop_inode+0x4f/0x70
[<c10c8b07>] iput+0x47/0x50
[<c10c0965>] do_unlinkat+0xd5/0x160
[<c10505c6>] ? up_read+0x16/0x30
[<c1022ab7>] ? do_page_fault+0x187/0x330
[<c1002fd8>] ? restore_all_notrace+0x0/0x18
[<c1022930>] ? do_page_fault+0x0/0x330
[<c105cbe4>] ? trace_hardirqs_on_caller+0x124/0x170
[<c10c0a00>] sys_unlink+0x10/0x20
[<c1002ec4>] sysenter_do_call+0x12/0x32
---[ end trace 2e35d71a6cc69d0c ]---
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Christian Kujau <lists@nerdbynature.de>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
2010-01-02 01:57:32 +01:00
..
2009-12-01 07:35:11 -08:00
2009-09-24 07:21:05 -07:00
2009-06-11 21:36:14 -04:00
2009-11-19 18:11:35 +00:00
2009-09-21 15:14:58 +02:00
2009-08-31 17:44:05 -10:00
2009-09-24 07:47:42 -04:00
2009-07-12 12:22:34 -07:00
2009-11-11 13:38:59 -08:00
2009-12-01 07:35:11 -08:00
2009-11-30 14:51:01 -08:00
2009-10-04 15:05:10 -07:00
2009-09-11 09:20:26 +02:00
2009-06-15 21:30:28 -07:00
2009-09-23 07:39:28 -07:00
2009-09-30 12:19:44 -05:00
2009-10-08 11:31:38 -05:00
2009-06-17 00:36:36 -04:00
2009-09-24 07:47:38 -04:00
2009-09-24 07:53:22 -07:00
2009-11-11 15:22:49 +01:00
2009-11-08 15:45:44 -05:00
2009-09-30 09:31:14 -07:00
2009-07-12 12:22:34 -07:00
2009-11-20 21:50:44 +00:00
2009-11-27 16:37:13 +01:00
2009-11-20 21:50:40 +00:00
2009-10-29 07:39:29 -07:00
2009-10-29 07:39:27 -07:00
2009-06-30 18:56:03 -07:00
2009-07-12 12:22:34 -07:00
2009-09-24 08:32:11 -07:00
2009-09-24 07:47:42 -04:00
2009-11-12 10:24:12 +01:00
2009-11-11 15:24:14 +01:00
2009-11-30 13:52:40 -08:00
2009-09-24 07:47:42 -04:00
2009-09-23 18:13:10 -07:00
2009-09-23 07:39:57 -07:00
2009-09-27 11:39:25 -07:00
2009-11-30 13:33:48 -08:00
2009-11-14 12:55:55 -08:00
2009-11-15 17:17:46 +09:00
2009-09-30 09:31:14 -07:00
2009-10-20 18:02:33 -04:00
2009-09-24 08:32:11 -07:00
2009-11-13 15:45:05 -08:00
2009-10-01 16:11:11 -07:00
2009-10-06 20:16:55 +02:00
2009-11-17 17:40:33 -08:00
2009-09-23 07:39:30 -07:00
2009-09-22 07:17:24 -07:00
2009-09-24 08:41:47 -04:00
2010-01-02 01:57:32 +01:00
2009-10-11 11:33:56 -07:00
2009-09-24 07:47:42 -04:00
2009-09-22 07:17:24 -07:00
2009-11-05 08:19:18 +11:00
2009-06-17 00:36:37 -04:00
2009-09-27 11:39:25 -07:00
2009-09-14 19:13:01 +02:00
2009-06-18 13:03:46 -07:00
2009-11-17 10:26:49 -06:00
2009-09-23 07:39:29 -07:00
2009-10-04 15:05:10 -07:00
2009-09-24 08:41:47 -04:00
2009-09-24 07:21:02 -07:00
2009-09-24 07:21:01 -07:00
2009-09-24 07:21:03 -07:00
2009-07-01 10:56:25 +02:00
2009-11-02 11:41:13 +01:00
2009-10-26 15:27:11 +01:00
2009-09-25 09:27:30 -07:00
2009-09-24 07:21:03 -07:00
2009-11-12 07:25:57 -08:00
2009-11-04 13:25:03 +01:00
2009-07-18 15:51:44 +02:00
2009-05-22 23:22:54 +02:00
2009-09-24 07:21:04 -07:00
2009-09-23 07:39:29 -07:00
2009-06-18 13:03:41 -07:00
2009-11-12 07:25:58 -08:00
2009-11-17 17:40:33 -08:00
2009-09-24 07:21:04 -07:00
2009-10-11 11:20:58 -07:00
2009-09-26 00:10:40 +02:00
2009-09-24 07:47:27 -04:00
2009-09-24 08:40:15 -04:00
2009-11-12 07:26:01 -08:00
2009-10-30 15:03:54 +11:00
2009-09-24 07:47:30 -04:00
2009-09-22 07:17:25 -07:00
2009-09-11 08:55:49 -07:00
2009-09-24 08:40:15 -04:00
2009-09-23 09:21:05 -07:00
2009-10-22 08:11:44 +09:00
2009-09-24 07:47:34 -04:00
2009-10-04 15:05:10 -07:00
2009-09-24 07:47:35 -04:00
2009-09-14 17:55:15 -07:00
2009-09-24 07:47:41 -04:00
2009-09-23 07:39:29 -07:00
2009-09-10 10:11:22 +10:00