xfs: more info from kmem deadlocks and high-level error msgs
authorEric Sandeen <sandeen@redhat.com>
Mon, 12 Oct 2015 05:04:45 +0000 (16:04 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 12 Oct 2015 05:04:45 +0000 (16:04 +1100)
In an effort to get more useful out of "possible memory
allocation deadlock" messages, print the size of the
requested allocation, and dump the stack if the xfs error
level is tuned high.

The stack dump is implemented in define_xfs_printk_level()
for error levels >= LOGLEVEL_ERR, partly because it
seems generically useful, and also because kmem.c has
no knowledge of xfs error level tunables or other such bits,
it's very kmem-specific.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/kmem.c
fs/xfs/xfs_message.c

index 535c13677e7a5857ecc4525e246f98d9594b0b4e..686ba6fb20ddc942638f6e698b98bf4c1bb8785f 100644 (file)
@@ -55,9 +55,9 @@ kmem_alloc(size_t size, xfs_km_flags_t flags)
                        return ptr;
                if (!(++retries % 100))
                        xfs_err(NULL,
-               "%s(%u) possible memory allocation deadlock in %s (mode:0x%x)",
+       "%s(%u) possible memory allocation deadlock size %u in %s (mode:0x%x)",
                                current->comm, current->pid,
-                               __func__, lflags);
+                               (unsigned int)size, __func__, lflags);
                congestion_wait(BLK_RW_ASYNC, HZ/50);
        } while (1);
 }
index d8b67547ab343ab9eded15a2d56113d001b73224..11792d888e4e707b91a528390deadbf212417e8e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_error.h"
 #include "xfs_format.h"
 #include "xfs_log_format.h"
 #include "xfs_trans_resv.h"
@@ -43,6 +44,7 @@ void func(const struct xfs_mount *mp, const char *fmt, ...)   \
 {                                                              \
        struct va_format        vaf;                            \
        va_list                 args;                           \
+       int                     level;                          \
                                                                \
        va_start(args, fmt);                                    \
                                                                \
@@ -51,6 +53,11 @@ void func(const struct xfs_mount *mp, const char *fmt, ...)  \
                                                                \
        __xfs_printk(kern_level, mp, &vaf);                     \
        va_end(args);                                           \
+                                                               \
+       if (!kstrtoint(kern_level, 0, &level) &&                \
+           level <= LOGLEVEL_ERR &&                            \
+           xfs_error_level >= XFS_ERRLEVEL_HIGH)               \
+               xfs_stack_trace();                              \
 }                                                              \
 
 define_xfs_printk_level(xfs_emerg, KERN_EMERG);
This page took 0.028003 seconds and 5 git commands to generate.