<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/include/linux/reiserfs_fs.h, branch linux-2.6.33.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing</title>
<updated>2010-01-02T19:17:05+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-01-02T19:17:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=45d28b097280a78893ce25a5d0db41e6a2717853'/>
<id>45d28b097280a78893ce25a5d0db41e6a2717853</id>
<content type='text'>
* 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  reiserfs: Safely acquire i_mutex from xattr_rmdir
  reiserfs: Safely acquire i_mutex from reiserfs_for_each_xattr
  reiserfs: Fix journal mutex &lt;-&gt; inode mutex lock inversion
  reiserfs: Fix unwanted recursive reiserfs lock in reiserfs_unlink()
  reiserfs: Relax lock before open xattr dir in reiserfs_xattr_set_handle()
  reiserfs: Relax reiserfs lock while freeing the journal
  reiserfs: Fix reiserfs lock &lt;-&gt; i_mutex dependency inversion on xattr
  reiserfs: Warn on lock relax if taken recursively
  reiserfs: Fix reiserfs lock &lt;-&gt; i_xattr_sem dependency inversion
  reiserfs: Fix remaining in-reclaim-fs &lt;-&gt; reclaim-fs-on locking inversion
  reiserfs: Fix reiserfs lock &lt;-&gt; inode mutex dependency inversion
  reiserfs: Fix reiserfs lock and journal lock inversion dependency
  reiserfs: Fix possible recursive lock
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  reiserfs: Safely acquire i_mutex from xattr_rmdir
  reiserfs: Safely acquire i_mutex from reiserfs_for_each_xattr
  reiserfs: Fix journal mutex &lt;-&gt; inode mutex lock inversion
  reiserfs: Fix unwanted recursive reiserfs lock in reiserfs_unlink()
  reiserfs: Relax lock before open xattr dir in reiserfs_xattr_set_handle()
  reiserfs: Relax reiserfs lock while freeing the journal
  reiserfs: Fix reiserfs lock &lt;-&gt; i_mutex dependency inversion on xattr
  reiserfs: Warn on lock relax if taken recursively
  reiserfs: Fix reiserfs lock &lt;-&gt; i_xattr_sem dependency inversion
  reiserfs: Fix remaining in-reclaim-fs &lt;-&gt; reclaim-fs-on locking inversion
  reiserfs: Fix reiserfs lock &lt;-&gt; inode mutex dependency inversion
  reiserfs: Fix reiserfs lock and journal lock inversion dependency
  reiserfs: Fix possible recursive lock
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: Warn on lock relax if taken recursively</title>
<updated>2010-01-02T00:54:37+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-12-30T02:20:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c4a62ca362258d98f42efb282cfbf9b61caffdbe'/>
<id>c4a62ca362258d98f42efb282cfbf9b61caffdbe</id>
<content type='text'>
When we relax the reiserfs lock to avoid creating unwanted
dependencies against others locks while grabbing these,
we want to ensure it has not been taken recursively, otherwise
the lock won't be really relaxed. Only its depth will be decreased.
The unwanted dependency would then actually happen.

To prevent from that, add a reiserfs_lock_check_recursive() call
in the places that need it.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we relax the reiserfs lock to avoid creating unwanted
dependencies against others locks while grabbing these,
we want to ensure it has not been taken recursively, otherwise
the lock won't be really relaxed. Only its depth will be decreased.
The unwanted dependency would then actually happen.

To prevent from that, add a reiserfs_lock_check_recursive() call
in the places that need it.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: Fix reiserfs lock &lt;-&gt; i_xattr_sem dependency inversion</title>
<updated>2010-01-02T00:54:04+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-12-29T23:39:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0719d3434747889b314a1e8add776418c4148bcf'/>
<id>0719d3434747889b314a1e8add776418c4148bcf</id>
<content type='text'>
i_xattr_sem depends on the reiserfs lock. But after we grab
i_xattr_sem, we may relax/relock the reiserfs lock while waiting
on a freezed filesystem, creating a dependency inversion between
the two locks.

In order to avoid the i_xattr_sem -&gt; reiserfs lock dependency, let's
create a reiserfs_down_read_safe() that acts like
reiserfs_mutex_lock_safe(): relax the reiserfs lock while grabbing
another lock to avoid undesired dependencies induced by the
heivyweight reiserfs lock.

This fixes the following warning:

[  990.005931] =======================================================
[  990.012373] [ INFO: possible circular locking dependency detected ]
[  990.013233] 2.6.33-rc1 #1
[  990.013233] -------------------------------------------------------
[  990.013233] dbench/1891 is trying to acquire lock:
[  990.013233]  (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}, at: [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]
[  990.013233] but task is already holding lock:
[  990.013233]  (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}, at: [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]
[  990.013233] which lock already depends on the new lock.
[  990.013233]
[  990.013233]
[  990.013233] the existing dependency chain (in reverse order) is:
[  990.013233]
[  990.013233] -&gt; #1 (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}:
[  990.013233]        [&lt;ffffffff81063afc&gt;] __lock_acquire+0xf9c/0x1560
[  990.013233]        [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]        [&lt;ffffffff814ac194&gt;] down_write+0x44/0x80
[  990.013233]        [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]        [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]        [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]        [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]        [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]        [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]        [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]        [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]        [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b
[  990.013233]
[  990.013233] -&gt; #0 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}:
[  990.013233]        [&lt;ffffffff81063e30&gt;] __lock_acquire+0x12d0/0x1560
[  990.013233]        [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]        [&lt;ffffffff814aba77&gt;] __mutex_lock_common+0x47/0x3b0
[  990.013233]        [&lt;ffffffff814abebe&gt;] mutex_lock_nested+0x3e/0x50
[  990.013233]        [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]        [&lt;ffffffff811340e5&gt;] reiserfs_prepare_write+0x45/0x180
[  990.013233]        [&lt;ffffffff81158bb6&gt;] reiserfs_xattr_set_handle+0x2a6/0x470
[  990.013233]        [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]        [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]        [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]        [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]        [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]        [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]        [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]        [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b
[  990.013233]
[  990.013233] other info that might help us debug this:
[  990.013233]
[  990.013233] 2 locks held by dbench/1891:
[  990.013233]  #0:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#12){+.+.+.}, at: [&lt;ffffffff810e2678&gt;] vfs_setxattr+0x78/0xc0
[  990.013233]  #1:  (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}, at: [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]
[  990.013233] stack backtrace:
[  990.013233] Pid: 1891, comm: dbench Not tainted 2.6.33-rc1 #1
[  990.013233] Call Trace:
[  990.013233]  [&lt;ffffffff81061639&gt;] print_circular_bug+0xe9/0xf0
[  990.013233]  [&lt;ffffffff81063e30&gt;] __lock_acquire+0x12d0/0x1560
[  990.013233]  [&lt;ffffffff8115899a&gt;] ? reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]  [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff8115899a&gt;] ? reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]  [&lt;ffffffff814aba77&gt;] __mutex_lock_common+0x47/0x3b0
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff81062592&gt;] ? mark_held_locks+0x72/0xa0
[  990.013233]  [&lt;ffffffff814ab81d&gt;] ? __mutex_unlock_slowpath+0xbd/0x140
[  990.013233]  [&lt;ffffffff810628ad&gt;] ? trace_hardirqs_on_caller+0x14d/0x1a0
[  990.013233]  [&lt;ffffffff814abebe&gt;] mutex_lock_nested+0x3e/0x50
[  990.013233]  [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff811340e5&gt;] reiserfs_prepare_write+0x45/0x180
[  990.013233]  [&lt;ffffffff81158bb6&gt;] reiserfs_xattr_set_handle+0x2a6/0x470
[  990.013233]  [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]  [&lt;ffffffff814abcb4&gt;] ? __mutex_lock_common+0x284/0x3b0
[  990.013233]  [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]  [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]  [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]  [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]  [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]  [&lt;ffffffff81056018&gt;] ? sched_clock_cpu+0xb8/0x100
[  990.013233]  [&lt;ffffffff8105eded&gt;] ? trace_hardirqs_off+0xd/0x10
[  990.013233]  [&lt;ffffffff810560a3&gt;] ? cpu_clock+0x43/0x50
[  990.013233]  [&lt;ffffffff810c6820&gt;] ? fget+0xb0/0x110
[  990.013233]  [&lt;ffffffff810c6770&gt;] ? fget+0x0/0x110
[  990.013233]  [&lt;ffffffff81002ddc&gt;] ? sysret_check+0x27/0x62
[  990.013233]  [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]  [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b

Reported-and-tested-by: Christian Kujau &lt;lists@nerdbynature.de&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
i_xattr_sem depends on the reiserfs lock. But after we grab
i_xattr_sem, we may relax/relock the reiserfs lock while waiting
on a freezed filesystem, creating a dependency inversion between
the two locks.

In order to avoid the i_xattr_sem -&gt; reiserfs lock dependency, let's
create a reiserfs_down_read_safe() that acts like
reiserfs_mutex_lock_safe(): relax the reiserfs lock while grabbing
another lock to avoid undesired dependencies induced by the
heivyweight reiserfs lock.

This fixes the following warning:

[  990.005931] =======================================================
[  990.012373] [ INFO: possible circular locking dependency detected ]
[  990.013233] 2.6.33-rc1 #1
[  990.013233] -------------------------------------------------------
[  990.013233] dbench/1891 is trying to acquire lock:
[  990.013233]  (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}, at: [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]
[  990.013233] but task is already holding lock:
[  990.013233]  (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}, at: [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]
[  990.013233] which lock already depends on the new lock.
[  990.013233]
[  990.013233]
[  990.013233] the existing dependency chain (in reverse order) is:
[  990.013233]
[  990.013233] -&gt; #1 (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}:
[  990.013233]        [&lt;ffffffff81063afc&gt;] __lock_acquire+0xf9c/0x1560
[  990.013233]        [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]        [&lt;ffffffff814ac194&gt;] down_write+0x44/0x80
[  990.013233]        [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]        [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]        [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]        [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]        [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]        [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]        [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]        [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]        [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b
[  990.013233]
[  990.013233] -&gt; #0 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}:
[  990.013233]        [&lt;ffffffff81063e30&gt;] __lock_acquire+0x12d0/0x1560
[  990.013233]        [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]        [&lt;ffffffff814aba77&gt;] __mutex_lock_common+0x47/0x3b0
[  990.013233]        [&lt;ffffffff814abebe&gt;] mutex_lock_nested+0x3e/0x50
[  990.013233]        [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]        [&lt;ffffffff811340e5&gt;] reiserfs_prepare_write+0x45/0x180
[  990.013233]        [&lt;ffffffff81158bb6&gt;] reiserfs_xattr_set_handle+0x2a6/0x470
[  990.013233]        [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]        [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]        [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]        [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]        [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]        [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]        [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]        [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b
[  990.013233]
[  990.013233] other info that might help us debug this:
[  990.013233]
[  990.013233] 2 locks held by dbench/1891:
[  990.013233]  #0:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#12){+.+.+.}, at: [&lt;ffffffff810e2678&gt;] vfs_setxattr+0x78/0xc0
[  990.013233]  #1:  (&amp;REISERFS_I(inode)-&gt;i_xattr_sem){+.+.+.}, at: [&lt;ffffffff8115899a&gt;] reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]
[  990.013233] stack backtrace:
[  990.013233] Pid: 1891, comm: dbench Not tainted 2.6.33-rc1 #1
[  990.013233] Call Trace:
[  990.013233]  [&lt;ffffffff81061639&gt;] print_circular_bug+0xe9/0xf0
[  990.013233]  [&lt;ffffffff81063e30&gt;] __lock_acquire+0x12d0/0x1560
[  990.013233]  [&lt;ffffffff8115899a&gt;] ? reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]  [&lt;ffffffff8106414f&gt;] lock_acquire+0x8f/0xb0
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff8115899a&gt;] ? reiserfs_xattr_set_handle+0x8a/0x470
[  990.013233]  [&lt;ffffffff814aba77&gt;] __mutex_lock_common+0x47/0x3b0
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff81159505&gt;] ? reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff81062592&gt;] ? mark_held_locks+0x72/0xa0
[  990.013233]  [&lt;ffffffff814ab81d&gt;] ? __mutex_unlock_slowpath+0xbd/0x140
[  990.013233]  [&lt;ffffffff810628ad&gt;] ? trace_hardirqs_on_caller+0x14d/0x1a0
[  990.013233]  [&lt;ffffffff814abebe&gt;] mutex_lock_nested+0x3e/0x50
[  990.013233]  [&lt;ffffffff81159505&gt;] reiserfs_write_lock+0x35/0x50
[  990.013233]  [&lt;ffffffff811340e5&gt;] reiserfs_prepare_write+0x45/0x180
[  990.013233]  [&lt;ffffffff81158bb6&gt;] reiserfs_xattr_set_handle+0x2a6/0x470
[  990.013233]  [&lt;ffffffff81158e30&gt;] reiserfs_xattr_set+0xb0/0x150
[  990.013233]  [&lt;ffffffff814abcb4&gt;] ? __mutex_lock_common+0x284/0x3b0
[  990.013233]  [&lt;ffffffff8115a6aa&gt;] user_set+0x8a/0x90
[  990.013233]  [&lt;ffffffff8115901a&gt;] reiserfs_setxattr+0xaa/0xb0
[  990.013233]  [&lt;ffffffff810e2596&gt;] __vfs_setxattr_noperm+0x36/0xa0
[  990.013233]  [&lt;ffffffff810e26bc&gt;] vfs_setxattr+0xbc/0xc0
[  990.013233]  [&lt;ffffffff810e2780&gt;] setxattr+0xc0/0x150
[  990.013233]  [&lt;ffffffff81056018&gt;] ? sched_clock_cpu+0xb8/0x100
[  990.013233]  [&lt;ffffffff8105eded&gt;] ? trace_hardirqs_off+0xd/0x10
[  990.013233]  [&lt;ffffffff810560a3&gt;] ? cpu_clock+0x43/0x50
[  990.013233]  [&lt;ffffffff810c6820&gt;] ? fget+0xb0/0x110
[  990.013233]  [&lt;ffffffff810c6770&gt;] ? fget+0x0/0x110
[  990.013233]  [&lt;ffffffff81002ddc&gt;] ? sysret_check+0x27/0x62
[  990.013233]  [&lt;ffffffff810e289d&gt;] sys_fsetxattr+0x8d/0xa0
[  990.013233]  [&lt;ffffffff81002dab&gt;] system_call_fastpath+0x16/0x1b

Reported-and-tested-by: Christian Kujau &lt;lists@nerdbynature.de&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: Fix reiserfs lock &lt;-&gt; inode mutex dependency inversion</title>
<updated>2009-12-16T22:25:50+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-12-16T22:25:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=47376ceba54600cec4dd9e7c4fe8b98e4269633a'/>
<id>47376ceba54600cec4dd9e7c4fe8b98e4269633a</id>
<content type='text'>
The reiserfs lock -&gt; inode mutex dependency gets inverted when we
relax the lock while walking to the tree.

To fix this, use a specialized version of reiserfs_mutex_lock_safe
that takes care of mutex subclasses. Then we can grab the inode
mutex with I_MUTEX_XATTR subclass without any reiserfs lock
dependency.

This fixes the following report:

[ INFO: possible circular locking dependency detected ]
2.6.32-06793-gf405425-dirty #2
-------------------------------------------------------
mv/18566 is trying to acquire lock:
 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}, at: [&lt;c1110708&gt;] reiserfs_write_lock+0x28=
/0x40

but task is already holding lock:
 (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}, at: [&lt;c111033c&gt;]
reiserfs_for_each_xattr+0x10c/0x380

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}:
       [&lt;c104f723&gt;] validate_chain+0xa23/0xf70
       [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
       [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
       [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
       [&lt;c11102b4&gt;] reiserfs_for_each_xattr+0x84/0x380
       [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
       [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
       [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
       [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
       [&lt;c10a4667&gt;] iput+0x47/0x50
       [&lt;c109cc0b&gt;] do_unlinkat+0xdb/0x160
       [&lt;c109cca0&gt;] sys_unlink+0x10/0x20
       [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

-&gt; #0 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}:
       [&lt;c104fc68&gt;] validate_chain+0xf68/0xf70
       [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
       [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
       [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
       [&lt;c1110708&gt;] reiserfs_write_lock+0x28/0x40
       [&lt;c1103d6b&gt;] search_by_key+0x1f7b/0x21b0
       [&lt;c10e73ef&gt;] search_by_entry_key+0x1f/0x3b0
       [&lt;c10e77f7&gt;] reiserfs_find_entry+0x77/0x400
       [&lt;c10e81e5&gt;] reiserfs_lookup+0x85/0x130
       [&lt;c109a144&gt;] __lookup_hash+0xb4/0x110
       [&lt;c109b763&gt;] lookup_one_len+0xb3/0x100
       [&lt;c1110350&gt;] reiserfs_for_each_xattr+0x120/0x380
       [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
       [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
       [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
       [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
       [&lt;c10a4667&gt;] iput+0x47/0x50
       [&lt;c10a1c4f&gt;] dentry_iput+0x6f/0xf0
       [&lt;c10a1d74&gt;] d_kill+0x24/0x50
       [&lt;c10a396b&gt;] dput+0x5b/0x120
       [&lt;c109ca89&gt;] sys_renameat+0x1b9/0x230
       [&lt;c109cb28&gt;] sys_rename+0x28/0x30
       [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

other info that might help us debug this:

2 locks held by mv/18566:
 #0:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/1){+.+.+.}, at: [&lt;c109b6ac&gt;]
lock_rename+0xcc/0xd0
 #1:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}, at: [&lt;c111033c&gt;]
reiserfs_for_each_xattr+0x10c/0x380

stack backtrace:
Pid: 18566, comm: mv Tainted: G         C 2.6.32-06793-gf405425-dirty #2
Call Trace:
 [&lt;c134b252&gt;] ? printk+0x18/0x1e
 [&lt;c104e790&gt;] print_circular_bug+0xc0/0xd0
 [&lt;c104fc68&gt;] validate_chain+0xf68/0xf70
 [&lt;c104c8cb&gt;] ? trace_hardirqs_off+0xb/0x10
 [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
 [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c134b60a&gt;] ? schedule+0x27a/0x440
 [&lt;c1110708&gt;] reiserfs_write_lock+0x28/0x40
 [&lt;c1103d6b&gt;] search_by_key+0x1f7b/0x21b0
 [&lt;c1050176&gt;] ? __lock_acquire+0x506/0xa70
 [&lt;c1051267&gt;] ? lock_release_non_nested+0x1e7/0x340
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c104e354&gt;] ? trace_hardirqs_on_caller+0x124/0x170
 [&lt;c104e3ab&gt;] ? trace_hardirqs_on+0xb/0x10
 [&lt;c1042a55&gt;] ? T.316+0x15/0x1a0
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c10e73ef&gt;] search_by_entry_key+0x1f/0x3b0
 [&lt;c134bf2a&gt;] ? __mutex_unlock_slowpath+0x9a/0x120
 [&lt;c104e354&gt;] ? trace_hardirqs_on_caller+0x124/0x170
 [&lt;c10e77f7&gt;] reiserfs_find_entry+0x77/0x400
 [&lt;c10e81e5&gt;] reiserfs_lookup+0x85/0x130
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c109a144&gt;] __lookup_hash+0xb4/0x110
 [&lt;c109b763&gt;] lookup_one_len+0xb3/0x100
 [&lt;c1110350&gt;] reiserfs_for_each_xattr+0x120/0x380
 [&lt;c110ffe0&gt;] ? delete_one_xattr+0x0/0x1c0
 [&lt;c1003342&gt;] ? math_error+0x22/0x150
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
 [&lt;c10a561f&gt;] ? generic_delete_inode+0x5f/0x150
 [&lt;c10ef4f0&gt;] ? reiserfs_delete_inode+0x0/0x140
 [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
 [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
 [&lt;c10a4667&gt;] iput+0x47/0x50
 [&lt;c10a1c4f&gt;] dentry_iput+0x6f/0xf0
 [&lt;c10a1d74&gt;] d_kill+0x24/0x50
 [&lt;c10a396b&gt;] dput+0x5b/0x120
 [&lt;c109ca89&gt;] sys_renameat+0x1b9/0x230
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c104c8cb&gt;] ? trace_hardirqs_off+0xb/0x10
 [&lt;c1042dde&gt;] ? cpu_clock+0x4e/0x60
 [&lt;c1350825&gt;] ? do_page_fault+0x155/0x370
 [&lt;c1041816&gt;] ? up_read+0x16/0x30
 [&lt;c1350825&gt;] ? do_page_fault+0x155/0x370
 [&lt;c109cb28&gt;] sys_rename+0x28/0x30
 [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

Reported-by: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The reiserfs lock -&gt; inode mutex dependency gets inverted when we
relax the lock while walking to the tree.

To fix this, use a specialized version of reiserfs_mutex_lock_safe
that takes care of mutex subclasses. Then we can grab the inode
mutex with I_MUTEX_XATTR subclass without any reiserfs lock
dependency.

This fixes the following report:

[ INFO: possible circular locking dependency detected ]
2.6.32-06793-gf405425-dirty #2
-------------------------------------------------------
mv/18566 is trying to acquire lock:
 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}, at: [&lt;c1110708&gt;] reiserfs_write_lock+0x28=
/0x40

but task is already holding lock:
 (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}, at: [&lt;c111033c&gt;]
reiserfs_for_each_xattr+0x10c/0x380

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}:
       [&lt;c104f723&gt;] validate_chain+0xa23/0xf70
       [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
       [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
       [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
       [&lt;c11102b4&gt;] reiserfs_for_each_xattr+0x84/0x380
       [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
       [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
       [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
       [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
       [&lt;c10a4667&gt;] iput+0x47/0x50
       [&lt;c109cc0b&gt;] do_unlinkat+0xdb/0x160
       [&lt;c109cca0&gt;] sys_unlink+0x10/0x20
       [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

-&gt; #0 (&amp;REISERFS_SB(s)-&gt;lock){+.+.+.}:
       [&lt;c104fc68&gt;] validate_chain+0xf68/0xf70
       [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
       [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
       [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
       [&lt;c1110708&gt;] reiserfs_write_lock+0x28/0x40
       [&lt;c1103d6b&gt;] search_by_key+0x1f7b/0x21b0
       [&lt;c10e73ef&gt;] search_by_entry_key+0x1f/0x3b0
       [&lt;c10e77f7&gt;] reiserfs_find_entry+0x77/0x400
       [&lt;c10e81e5&gt;] reiserfs_lookup+0x85/0x130
       [&lt;c109a144&gt;] __lookup_hash+0xb4/0x110
       [&lt;c109b763&gt;] lookup_one_len+0xb3/0x100
       [&lt;c1110350&gt;] reiserfs_for_each_xattr+0x120/0x380
       [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
       [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
       [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
       [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
       [&lt;c10a4667&gt;] iput+0x47/0x50
       [&lt;c10a1c4f&gt;] dentry_iput+0x6f/0xf0
       [&lt;c10a1d74&gt;] d_kill+0x24/0x50
       [&lt;c10a396b&gt;] dput+0x5b/0x120
       [&lt;c109ca89&gt;] sys_renameat+0x1b9/0x230
       [&lt;c109cb28&gt;] sys_rename+0x28/0x30
       [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

other info that might help us debug this:

2 locks held by mv/18566:
 #0:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/1){+.+.+.}, at: [&lt;c109b6ac&gt;]
lock_rename+0xcc/0xd0
 #1:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#5/3){+.+.+.}, at: [&lt;c111033c&gt;]
reiserfs_for_each_xattr+0x10c/0x380

stack backtrace:
Pid: 18566, comm: mv Tainted: G         C 2.6.32-06793-gf405425-dirty #2
Call Trace:
 [&lt;c134b252&gt;] ? printk+0x18/0x1e
 [&lt;c104e790&gt;] print_circular_bug+0xc0/0xd0
 [&lt;c104fc68&gt;] validate_chain+0xf68/0xf70
 [&lt;c104c8cb&gt;] ? trace_hardirqs_off+0xb/0x10
 [&lt;c1050155&gt;] __lock_acquire+0x4e5/0xa70
 [&lt;c105075a&gt;] lock_acquire+0x7a/0xa0
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c134c76f&gt;] mutex_lock_nested+0x5f/0x2b0
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c134b60a&gt;] ? schedule+0x27a/0x440
 [&lt;c1110708&gt;] reiserfs_write_lock+0x28/0x40
 [&lt;c1103d6b&gt;] search_by_key+0x1f7b/0x21b0
 [&lt;c1050176&gt;] ? __lock_acquire+0x506/0xa70
 [&lt;c1051267&gt;] ? lock_release_non_nested+0x1e7/0x340
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c104e354&gt;] ? trace_hardirqs_on_caller+0x124/0x170
 [&lt;c104e3ab&gt;] ? trace_hardirqs_on+0xb/0x10
 [&lt;c1042a55&gt;] ? T.316+0x15/0x1a0
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c10e73ef&gt;] search_by_entry_key+0x1f/0x3b0
 [&lt;c134bf2a&gt;] ? __mutex_unlock_slowpath+0x9a/0x120
 [&lt;c104e354&gt;] ? trace_hardirqs_on_caller+0x124/0x170
 [&lt;c10e77f7&gt;] reiserfs_find_entry+0x77/0x400
 [&lt;c10e81e5&gt;] reiserfs_lookup+0x85/0x130
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c109a144&gt;] __lookup_hash+0xb4/0x110
 [&lt;c109b763&gt;] lookup_one_len+0xb3/0x100
 [&lt;c1110350&gt;] reiserfs_for_each_xattr+0x120/0x380
 [&lt;c110ffe0&gt;] ? delete_one_xattr+0x0/0x1c0
 [&lt;c1003342&gt;] ? math_error+0x22/0x150
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c1110615&gt;] reiserfs_delete_xattrs+0x15/0x50
 [&lt;c1110708&gt;] ? reiserfs_write_lock+0x28/0x40
 [&lt;c10ef57f&gt;] reiserfs_delete_inode+0x8f/0x140
 [&lt;c10a561f&gt;] ? generic_delete_inode+0x5f/0x150
 [&lt;c10ef4f0&gt;] ? reiserfs_delete_inode+0x0/0x140
 [&lt;c10a565c&gt;] generic_delete_inode+0x9c/0x150
 [&lt;c10a574d&gt;] generic_drop_inode+0x3d/0x60
 [&lt;c10a4667&gt;] iput+0x47/0x50
 [&lt;c10a1c4f&gt;] dentry_iput+0x6f/0xf0
 [&lt;c10a1d74&gt;] d_kill+0x24/0x50
 [&lt;c10a396b&gt;] dput+0x5b/0x120
 [&lt;c109ca89&gt;] sys_renameat+0x1b9/0x230
 [&lt;c1042d2d&gt;] ? sched_clock_cpu+0x9d/0x100
 [&lt;c104c8cb&gt;] ? trace_hardirqs_off+0xb/0x10
 [&lt;c1042dde&gt;] ? cpu_clock+0x4e/0x60
 [&lt;c1350825&gt;] ? do_page_fault+0x155/0x370
 [&lt;c1041816&gt;] ? up_read+0x16/0x30
 [&lt;c1350825&gt;] ? do_page_fault+0x155/0x370
 [&lt;c109cb28&gt;] sys_rename+0x28/0x30
 [&lt;c1002c50&gt;] sysenter_do_call+0x12/0x36

Reported-by: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: don't compile procfs.o at all if no support</title>
<updated>2009-12-16T15:20:06+00:00</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2009-12-16T00:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e3c96f53ac132743fda1384910feb863a2eab916'/>
<id>e3c96f53ac132743fda1384910feb863a2eab916</id>
<content type='text'>
* small define cleanup in header
* fix #ifdeffery in procfs.c via Kconfig

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* small define cleanup in header
* fix #ifdeffery in procfs.c via Kconfig

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: remove /proc/fs/reiserfs/version</title>
<updated>2009-12-16T15:20:06+00:00</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2009-12-16T00:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=904e812931f001b984912b2d2f653ea69520313c'/>
<id>904e812931f001b984912b2d2f653ea69520313c</id>
<content type='text'>
/proc/fs/reiserfs/version is on the way of removing -&gt;read_proc interface.
 It's empty however, so simply remove it instead of doing dummy
conversion.  It's hard to see what information userspace can extract from
empty file.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
/proc/fs/reiserfs/version is on the way of removing -&gt;read_proc interface.
 It's empty however, so simply remove it instead of doing dummy
conversion.  It's hard to see what information userspace can extract from
empty file.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kill-the-bkl/reiserfs: definitely drop the bkl from reiserfs_ioctl()</title>
<updated>2009-10-14T21:28:12+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-10-14T21:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=205cb37b89ab37db553907e5ac17962eec561804'/>
<id>205cb37b89ab37db553907e5ac17962eec561804</id>
<content type='text'>
The reiserfs ioctl path doesn't need the big kernel lock anymore , now
that the filesystem synchronizes through its own lock.

We can then turn reiserfs_ioctl() into an unlocked_ioctl callback.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Laurent Riffard &lt;laurent.riffard@free.fr&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The reiserfs ioctl path doesn't need the big kernel lock anymore , now
that the filesystem synchronizes through its own lock.

We can then turn reiserfs_ioctl() into an unlocked_ioctl callback.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Cc: Laurent Riffard &lt;laurent.riffard@free.fr&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kill-the-bkl/reiserfs: acquire the inode mutex safely</title>
<updated>2009-09-14T05:18:24+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-05-16T16:12:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c72e05756b900b3be24cd73a16de52bab80984c0'/>
<id>c72e05756b900b3be24cd73a16de52bab80984c0</id>
<content type='text'>
While searching a pathname, an inode mutex can be acquired
in do_lookup() which calls reiserfs_lookup() which in turn
acquires the write lock.

On the other side reiserfs_fill_super() can acquire the write_lock
and then call reiserfs_lookup_privroot() which can acquire an
inode mutex (the root of the mount point).

So we theoretically risk an AB - BA lock inversion that could lead
to a deadlock.

As for other lock dependencies found since the bkl to mutex
conversion, the fix is to use reiserfs_mutex_lock_safe() which
drops the lock dependency to the write lock.

[ Impact: fix a possible deadlock with reiserfs ]

Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While searching a pathname, an inode mutex can be acquired
in do_lookup() which calls reiserfs_lookup() which in turn
acquires the write lock.

On the other side reiserfs_fill_super() can acquire the write_lock
and then call reiserfs_lookup_privroot() which can acquire an
inode mutex (the root of the mount point).

So we theoretically risk an AB - BA lock inversion that could lead
to a deadlock.

As for other lock dependencies found since the bkl to mutex
conversion, the fix is to use reiserfs_mutex_lock_safe() which
drops the lock dependency to the write lock.

[ Impact: fix a possible deadlock with reiserfs ]

Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kill-the-bkl/reiserfs: conditionaly release the write lock on fs_changed()</title>
<updated>2009-09-14T05:18:15+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-05-07T21:25:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d663af807d8bb226394cb7e02f4665f6141a8140'/>
<id>d663af807d8bb226394cb7e02f4665f6141a8140</id>
<content type='text'>
The goal of fs_changed() is to check whether the tree changed during a
schedule(). This is a BKL legacy.

A recent patch added an explicit unconditional release/reacquire of the
write lock around the cond_resched() called inside fs_changed.

But it's wasteful to unconditionally do that, we are creating superfluous
lock contention in !TIF_NEED_RESCHED case.

This patch manage that by calling reiserfs_cond_resched() from fs_changed()
which only releases the lock if we are going to reschedule.

[ Impact: inject less lock contention and tree job retries ]

Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The goal of fs_changed() is to check whether the tree changed during a
schedule(). This is a BKL legacy.

A recent patch added an explicit unconditional release/reacquire of the
write lock around the cond_resched() called inside fs_changed.

But it's wasteful to unconditionally do that, we are creating superfluous
lock contention in !TIF_NEED_RESCHED case.

This patch manage that by calling reiserfs_cond_resched() from fs_changed()
which only releases the lock if we are going to reschedule.

[ Impact: inject less lock contention and tree job retries ]

Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kill-the-BKL/reiserfs: add reiserfs_cond_resched()</title>
<updated>2009-09-14T05:18:14+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-05-07T20:51:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e43d3f21c502dec786f2885a75e25859f18d6ffa'/>
<id>e43d3f21c502dec786f2885a75e25859f18d6ffa</id>
<content type='text'>
Usually, when we call cond_resched(), we want the write lock
to be released and then reacquired once we return from scheduling.
Not only does it follow the previous bkl based locking scheme, but
it also let other waiters to get the lock.

But if we aren't going to reschedule(), such as in !TIF_NEED_RESCHED
case, it's useless to release the lock. Worse, if we release and reacquire
the lock whereas it is not needed, we create useless contentions. Also
if someone takes the lock while we are modifying or reading the tree,
there are good chances we'll have to retry our operation, eg if the
block we were seeeking has moved.

So this patch introduces a helper which only unlock the write lock
if we are going to schedule.

[ Impact: prepare to inject less lock contention and less tree operation attempts ]

Reported-by: Andi Kleen &lt;andi@firstfloor.org&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Usually, when we call cond_resched(), we want the write lock
to be released and then reacquired once we return from scheduling.
Not only does it follow the previous bkl based locking scheme, but
it also let other waiters to get the lock.

But if we aren't going to reschedule(), such as in !TIF_NEED_RESCHED
case, it's useless to release the lock. Worse, if we release and reacquire
the lock whereas it is not needed, we create useless contentions. Also
if someone takes the lock while we are modifying or reading the tree,
there are good chances we'll have to retry our operation, eg if the
block we were seeeking has moved.

So this patch introduces a helper which only unlock the write lock
if we are going to schedule.

[ Impact: prepare to inject less lock contention and less tree operation attempts ]

Reported-by: Andi Kleen &lt;andi@firstfloor.org&gt;
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Alexander Beregalov &lt;a.beregalov@gmail.com&gt;
Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
