]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: reiserfs: introduce reiserfs_error() | |
3 | ||
4 | Although reiserfs can currently handle severe errors such as journal failure, | |
5 | it cannot handle less severe errors like metadata i/o failure. The following | |
6 | patch adds a reiserfs_error() function akin to the one in ext3. | |
7 | ||
8 | Subsequent patches will use this new error handler to handle errors more | |
9 | gracefully in general. | |
10 | ||
11 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
12 | ||
13 | -- | |
14 | fs/reiserfs/prints.c | 25 +++++++++++++++++++++++++ | |
15 | include/linux/reiserfs_fs.h | 4 ++++ | |
16 | 2 files changed, 29 insertions(+) | |
17 | ||
18 | --- a/fs/reiserfs/prints.c | |
19 | +++ b/fs/reiserfs/prints.c | |
20 | @@ -373,6 +373,31 @@ void __reiserfs_panic(struct super_block | |
21 | id ? id : "", id ? " " : "", function, error_buf); | |
22 | } | |
23 | ||
24 | +void __reiserfs_error(struct super_block *sb, const char *id, | |
25 | + const char *function, const char *fmt, ...) | |
26 | +{ | |
27 | + do_reiserfs_warning(fmt); | |
28 | + | |
29 | + BUG_ON(sb == NULL); | |
30 | + | |
31 | + if (reiserfs_error_panic(sb)) | |
32 | + __reiserfs_panic(sb, id, function, error_buf); | |
33 | + | |
34 | + if (id && id[0]) | |
35 | + printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n", | |
36 | + sb->s_id, id, function, error_buf); | |
37 | + else | |
38 | + printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", | |
39 | + sb->s_id, function, error_buf); | |
40 | + | |
41 | + if (sb->s_flags & MS_RDONLY) | |
42 | + return; | |
43 | + | |
44 | + reiserfs_info(sb, "Remounting filesystem read-only\n"); | |
45 | + sb->s_flags |= MS_RDONLY; | |
46 | + reiserfs_abort_journal(sb, -EIO); | |
47 | +} | |
48 | + | |
49 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) | |
50 | { | |
51 | do_reiserfs_warning(fmt); | |
52 | --- a/include/linux/reiserfs_fs.h | |
53 | +++ b/include/linux/reiserfs_fs.h | |
54 | @@ -2006,6 +2006,10 @@ void __reiserfs_panic(struct super_block | |
55 | __attribute__ ((noreturn)); | |
56 | #define reiserfs_panic(s, id, fmt, args...) \ | |
57 | __reiserfs_panic(s, id, __func__, fmt, ##args) | |
58 | +void __reiserfs_error(struct super_block *s, const char *id, | |
59 | + const char *function, const char *fmt, ...); | |
60 | +#define reiserfs_error(s, id, fmt, args...) \ | |
61 | + __reiserfs_error(s, id, __func__, fmt, ##args) | |
62 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | |
63 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | |
64 | void print_indirect_item(struct buffer_head *bh, int item_num); |