Skip to contentSkip to conversation

fs,btrfs: fix rt deadlock on extent_buffer->lock

PATCH New Steven Rostedt 1 participant 1 message Mar 17, 2015 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 fs,btrfs: fix rt deadlock on extent_buffer->lock

3.4.106-rt132-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Mike Galbraith <[email protected]>

Sat Jul 14 12:30:41 CEST 2012

Trivially repeatable deadlock is cured by enabling lockdep code in btrfs_clear_path_blocking() as suggested by Chris Mason. He also suggested restricting blocking reader count to one, and not allowing a spinning reader while blocking reader exists. This has proven to be unnecessary, the strict lock order enforcement is enough.. or rather that's my box's opinion after long hours of hard pounding.

Note: extent-tree.c bit is additional recommendation from Chris
Mason, split into a separate patch after discussion.

Cc linux-rt-users <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Carsten Emde <[email protected]>
Cc John Kacur <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Clark Williams <[email protected]>
Cc Chris Mason <[email protected]>

Conflicts:
fs/btrfs/extent-tree.c

---
 fs/btrfs/ctree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/ctree.c +2 -2
index 4106264fbc65..ae47cc2c9f2f 100644
@@ -77,7 +77,7 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
 {
 	int i;
 
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#if (defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_PREEMPT_RT_BASE))
 	/* lockdep really cares that we take all of these spinlocks
 	 * in the right order.  If any of the locks in the path are not
 	 * currently blocking, it is going to complain.  So, make really
@@ -104,7 +104,7 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
 		}
 	}
 
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#if (defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_PREEMPT_RT_BASE))
 	if (held)
 		btrfs_clear_lock_blocking_rw(held, held_rw);
 #endif
Signature · 1 line
2.1.4