summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 12:16:36 -0700
commit1e5e59d431038c53954fe8f0b38bee0f0ad30349 (patch)
tree25e10648779424a85de6d368bd08c53c51c8f7a8 /fs
parent32e8b1062915d00d07d3b88a95174648e369b6a3 (diff)
downloadlinux-1e5e59d431038c53954fe8f0b38bee0f0ad30349.tar.gz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/prints.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index 84f3f69652e3..8e826c07cd21 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -370,6 +370,31 @@ void __reiserfs_panic(struct super_block *sb, const char *id,
 		      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, ...)
 {
 	do_reiserfs_warning(fmt);