# \[PATCH RT 5/9\]\[RFC\] \[PATCH 5/9\] ring-buffer/rt: Check for irqs disabled before grabbing reader lock

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2012-03-01 19:03:50 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2012/03/3829554
- Thread: https://ratatoskr.run/linux-rt-users/2012/03/3829562/t.md

```text
In RT the reader lock is a mutex and we can not grab it when preemption is
disabled. The in_atomic() check that is there does not check if irqs are
disabled. Add that check as well.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ring_buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 354017f..c060f04 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1054,7 +1054,7 @@ static inline int ok_to_lock(void)
 	if (in_nmi())
 		return 0;
 #ifdef CONFIG_PREEMPT_RT_FULL
-	if (in_atomic())
+	if (in_atomic() || irqs_disabled())
 		return 0;
 #endif
 	return 1;
-- 
1.7.3.4


```
