Re: [PATCH 2/2] Use the cut_here() function in AFS, CacheFiles,FS-Cache and RxRPC

From: Linus Torvalds
Date: Thu Aug 20 2009 - 11:33:43 EST




On Thu, 20 Aug 2009, David Howells wrote:
>
> Use the cut_here() function in AFS, CacheFiles, FS-Cache and RxRPC to put
> pertinent extra information between the "cut here" line and the BUG report.

No. This is fundamentally the wrong approach.

> #define ASSERT(X) \
> do { \
> if (unlikely(!(X))) { \
> - printk(KERN_ERR "\n"); \
> + cut_here(); \
> printk(KERN_ERR "AFS: Assertion failed\n"); \
> BUG(); \

Instead of doing that "cut_here()" thing, you should either use the WARN()
thing that has a format string already, or we should extend BUG() to have
that kind of thing too. So in this case I think that you should use WARN()
instead, ie change it to be

#define ASSERT(x) do { \
if (WARN(X, "AFS: Assertion failed")) \
do_exit(SIGSEGV); \
} while (0)

instead. And yes, in the long run, I really think we should just extend
the current BUG() reporting to have that kind of semantics, but I think
your "cut_here()" thing is a horrible hack.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/