reiserfs: introduce reiserfs_error()

Although reiserfs can currently handle severe errors such as journal failure,
it cannot handle less severe errors like metadata i/o failure. The following
patch adds a reiserfs_error() function akin to the one in ext3.

Subsequent patches will use this new error handler to handle errors more
gracefully in general.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jeff Mahoney 2009-03-30 14:02:27 -04:00 committed by Linus Torvalds
parent 32e8b10629
commit 1e5e59d431
2 changed files with 29 additions and 0 deletions

View File

@ -370,6 +370,31 @@ void __reiserfs_panic(struct super_block *sb, const char *id,
id ? id : "", id ? " " : "", function, error_buf); id ? id : "", id ? " " : "", function, error_buf);
} }
void __reiserfs_error(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
BUG_ON(sb == NULL);
if (reiserfs_error_panic(sb))
__reiserfs_panic(sb, id, function, error_buf);
if (id && id[0])
printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n",
sb->s_id, id, function, error_buf);
else
printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n",
sb->s_id, function, error_buf);
if (sb->s_flags & MS_RDONLY)
return;
reiserfs_info(sb, "Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY;
reiserfs_abort_journal(sb, -EIO);
}
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
{ {
do_reiserfs_warning(fmt); do_reiserfs_warning(fmt);

View File

@ -2006,6 +2006,10 @@ void __reiserfs_panic(struct super_block *s, const char *id,
__attribute__ ((noreturn)); __attribute__ ((noreturn));
#define reiserfs_panic(s, id, fmt, args...) \ #define reiserfs_panic(s, id, fmt, args...) \
__reiserfs_panic(s, id, __func__, fmt, ##args) __reiserfs_panic(s, id, __func__, fmt, ##args)
void __reiserfs_error(struct super_block *s, const char *id,
const char *function, const char *fmt, ...);
#define reiserfs_error(s, id, fmt, args...) \
__reiserfs_error(s, id, __func__, fmt, ##args)
void reiserfs_info(struct super_block *s, const char *fmt, ...); void reiserfs_info(struct super_block *s, const char *fmt, ...);
void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
void print_indirect_item(struct buffer_head *bh, int item_num); void print_indirect_item(struct buffer_head *bh, int item_num);