[patch 10/11] reiserfs: introduce reiserfs_error()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 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@xxxxxxxx>

--
 fs/reiserfs/prints.c        |   23 +++++++++++++++++++++++
 include/linux/reiserfs_fs.h |    3 +++
 2 files changed, 26 insertions(+)

--- a/fs/reiserfs/prints.c	2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/prints.c	2007-06-11 14:50:04.000000000 -0400
@@ -373,6 +373,29 @@ void __reiserfs_panic(struct super_block
 		      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);
+
+	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);
--- a/include/linux/reiserfs_fs.h	2007-06-11 14:49:35.000000000 -0400
+++ b/include/linux/reiserfs_fs.h	2007-06-11 14:50:08.000000000 -0400
@@ -1992,6 +1992,9 @@ void __reiserfs_panic(struct super_block
     __attribute__ ((noreturn));
 #define reiserfs_panic(s, id, fmt, args...) \
         __reiserfs_panic(s, id, __FUNCTION__, 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, __FUNCTION__, fmt, ##args)
 void reiserfs_info(struct super_block *s, 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);

-- 
Jeff Mahoney
SUSE Labs

-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux