From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/ocfs2/inode.c | 13 +++++++++++++ fs/ocfs2/sysfs.c | 17 ++++++++++++++++- fs/ocfs2/sysfs.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 12f4a9e..a6cfe5d 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -54,6 +54,7 @@ #include "refcounttree.h" #include "ocfs2_trace.h" #include "filecheck.h" +#include "sysfs.h" #include "buffer_head_io.h" @@ -1412,6 +1413,9 @@ int ocfs2_validate_inode_block(struct super_block *sb, rc = ocfs2_error(sb, "Invalid dinode #%llu: signature = %.*s\n", (unsigned long long)bh->b_blocknr, 7, di->i_signature); + ocfs2_report_error(OCFS2_SB(sb), (unsigned long long)bh->b_blocknr, + (unsigned long long)bh->b_blocknr, + rc); goto bail; } @@ -1419,6 +1423,9 @@ int ocfs2_validate_inode_block(struct super_block *sb, rc = ocfs2_error(sb, "Invalid dinode #%llu: i_blkno is %llu\n", (unsigned long long)bh->b_blocknr, (unsigned long long)le64_to_cpu(di->i_blkno)); + ocfs2_report_error(OCFS2_SB(sb), (unsigned long long)bh->b_blocknr, + (unsigned long long)bh->b_blocknr, + rc); goto bail; } @@ -1426,6 +1433,9 @@ int ocfs2_validate_inode_block(struct super_block *sb, rc = ocfs2_error(sb, "Invalid dinode #%llu: OCFS2_VALID_FL not set\n", (unsigned long long)bh->b_blocknr); + ocfs2_report_error(OCFS2_SB(sb), (unsigned long long)bh->b_blocknr, + (unsigned long long)bh->b_blocknr, + rc); goto bail; } @@ -1435,6 +1445,9 @@ int ocfs2_validate_inode_block(struct super_block *sb, "Invalid dinode #%llu: fs_generation is %u\n", (unsigned long long)bh->b_blocknr, le32_to_cpu(di->i_fs_generation)); + ocfs2_report_error(OCFS2_SB(sb), (unsigned long long)bh->b_blocknr, + (unsigned long long)bh->b_blocknr, + rc); goto bail; } diff --git a/fs/ocfs2/sysfs.c b/fs/ocfs2/sysfs.c index 1cf384f..fb7231c 100644 --- a/fs/ocfs2/sysfs.c +++ b/fs/ocfs2/sysfs.c @@ -103,5 +103,20 @@ struct kobj_type ocfs2_sb_ktype = { .release = super_block_release, }; - +void ocfs2_report_error(struct ocfs2_super *osb, unsigned long long ino, + unsigned long long blkno, int errno) +{ + char event_name[] = "EVENT=FS_ERROR"; + char device[16]; + char inode_number[16]; + char error_number[16]; + char block_number[16]; + char *envp[] = {event_name, inode_number, error_number, block_number, + NULL}; + snprintf(device, 16, "DEVICE=%s", osb->sb->s_id); + snprintf(error_number, 16, "ERROR=%d", errno); + snprintf(inode_number, 16, "INODE=%llu", ino); + snprintf(block_number, 16, "BLOCK=%llu", blkno); + sb_report_event(osb->sb, envp); +} diff --git a/fs/ocfs2/sysfs.h b/fs/ocfs2/sysfs.h index 5809e9b..e31107c 100644 --- a/fs/ocfs2/sysfs.h +++ b/fs/ocfs2/sysfs.h @@ -4,5 +4,7 @@ #define _SYS_H extern struct kobj_type ocfs2_sb_ktype; +void ocfs2_report_error(struct ocfs2_super *osb, unsigned long long ino, + unsigned long long blkno, int error); #endif -- 2.6.6 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html