aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.h9
-rw-r--r--fs/btrfs/super.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 78fba44ad3d9..1e3a994e1899 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3653,11 +3653,14 @@ __printf(5, 6)
3653void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, 3653void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
3654 unsigned int line, int errno, const char *fmt, ...); 3654 unsigned int line, int errno, const char *fmt, ...);
3655 3655
3656/*
3657 * If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
3658 * will panic(). Otherwise we BUG() here.
3659 */
3656#define btrfs_panic(fs_info, errno, fmt, args...) \ 3660#define btrfs_panic(fs_info, errno, fmt, args...) \
3657do { \ 3661do { \
3658 struct btrfs_fs_info *_i = (fs_info); \ 3662 __btrfs_panic(fs_info, __func__, __LINE__, errno, fmt, ##args); \
3659 __btrfs_panic(_i, __func__, __LINE__, errno, fmt, ##args); \ 3663 BUG(); \
3660 BUG_ON(!(_i->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)); \
3661} while (0) 3664} while (0)
3662 3665
3663/* acl.c */ 3666/* acl.c */
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index fd6a07c30ee9..06537d217419 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -289,7 +289,7 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
289 vaf.va = &args; 289 vaf.va = &args;
290 290
291 errstr = btrfs_decode_error(errno, nbuf); 291 errstr = btrfs_decode_error(errno, nbuf);
292 if (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR) 292 if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR))
293 panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n", 293 panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n",
294 s_id, function, line, &vaf, errstr); 294 s_id, function, line, &vaf, errstr);
295 295