From: lijinlin lijinlin3@huawei.com
euleros inclusion category: feature feature: add ext3 report error to userspace by netlink bugzilla: NA
--------------------------------
reason: This patch is used to implement abnormal alarm of ext3 file system. You can achieve this by setting "FILESYSTEM_MONITOR" or "FILESYSTEM_ALARM" on in configuration file. With this setting, alarm will be raised whenext3 file system expection occurs.
Signed-off-by: lijinlin lijinlin3@huawei.com Reviewed-by: zhangyi (F) yi.zhang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/ext4/ext4.h | 3 +++ fs/ext4/super.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index bcaf1538b3ba..8797c05f27c0 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -55,7 +55,10 @@ #endif
#define NL_EXT4_ERROR_GROUP 1 + +#define EXT3_ERROR_MAGIC 0xAE43125U #define EXT4_ERROR_MAGIC 0xAE32014U + struct ext4_err_msg { int magic; char s_id[32]; diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 15af76d547e0..15f8aeda9ee7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -455,6 +455,8 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno) struct ext4_err_msg *msg;
if (ext4nl) { + if (IS_EXT2_SB(sb)) + return; size = NLMSG_SPACE(sizeof(struct ext4_err_msg)); skb = alloc_skb(size, GFP_ATOMIC); if (!skb) { @@ -466,7 +468,10 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno) if (!nlh) goto nlmsg_failure; msg = (struct ext4_err_msg *)NLMSG_DATA(nlh); - msg->magic = EXT4_ERROR_MAGIC; + if (IS_EXT3_SB(sb)) + msg->magic = EXT3_ERROR_MAGIC; + else + msg->magic = EXT4_ERROR_MAGIC; memcpy(msg->s_id, sb->s_id, sizeof(sb->s_id)); msg->s_flags = sb->s_flags; msg->ext4_errno = ext4_errno;