lockdep: check that no locks held at freeze time
[firefly-linux-kernel-4.4.55.git] / include / linux / freezer.h
index e70df40d84f6fe83c72f732aa44b454148661b6e..043a5cf8b5baf3e917dd9ba265c365a334365216 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef FREEZER_H_INCLUDED
 #define FREEZER_H_INCLUDED
 
+#include <linux/debug_locks.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <linux/atomic.h>
@@ -48,6 +49,8 @@ extern void thaw_kernel_threads(void);
 
 static inline bool try_to_freeze(void)
 {
+       if (!(current->flags & PF_NOFREEZE))
+               debug_check_no_locks_held();
        might_sleep();
        if (likely(!freezing(current)))
                return false;