#ifndef DIE_H #define DIE_H #include #include #include #include #include #include #include #include #include "built_in.h" extern void panic_handler_add(void (*on_panic)(void *arg), void *arg); extern void call_panic_handlers(void); static inline void panic(const char *format, ...) __check_format_printf(1, 2); static inline void syslog_panic(const char *format, ...) __check_format_printf(1, 2); static inline void syslog_maybe(bool cond, int priority, const char *format, ...) __check_format_printf(3, 4); static inline void __noreturn __die_hard(void) { call_panic_handlers(); exit(EXIT_FAILURE); } static inline void __noreturn __die_harder(void) { call_panic_handlers(); _exit(EXIT_FAILURE); } static inline void __noreturn die(void) { __die_hard(); } static inline void __noreturn _die(void) { __die_harder(); } static inline void __noreturn panic(const char *format, ...) { va_list vl; va_start(vl, format); vfprintf(stderr, format, vl); va_end(vl); die(); } static inline void __noreturn syslog_panic(const char *format, ...) { va_list vl; va_start(vl, format); vsyslog(LOG_ERR, format, vl); va_end(vl); die(); } static inline void syslog_maybe(bool cond, int priority, const char *format, ...) { if (cond) { va_list vl; va_start(vl, format); vsyslog(priority, format, vl); va_end(vl); } } #endif /* DIE_H */ r>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2016-07-13 11:45:02 -0600
committerJens Axboe <axboe@fb.com>2016-07-14 08:48:08 -0700
commit32f0c4afb4363e31dad49202f1554ba591d649f2 (patch)
treeb0b789ae8f42f0f987776671f8828c4e36a63280
parent92d21ac74a9e3c09b0b01c764e530657e4c85c49 (diff)
nvme: Remove RCU namespace protection
We can't sleep with RCU read lock held, but we need to do potentially blocking stuff to namespace queues when iterating the list. This patch removes the RCU locking and holds a mutex instead. To prevent deadlocks, this patch removes holding the mutex during namespace scanning and removal. The unlocked namespace scanning is made safe by holding a reference to the namespace being scanned. List iteration that does IO has to be unlocked to allow error recovery. The caller must ensure the list can not be manipulated during such an event, so this patch adds a comment explaining this requirement to the only function that iterates an unlocked list. All callers currently meet this requirement, so no further changes required. List iterations that do not do IO can safely use the lock since it couldn't block recovery from missing forced IO completions. Reported-by: Ming Lin <mlin at kernel.org> [fixes 0bf77e9 nvme: switch to RCU freeing the namespace] Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>