提交 e131b1c1 编写于 作者: L lijinlin 提交者: Yang Yingliang

ext4: add ext3 report error to userspace by netlink

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: Nlijinlin <lijinlin3@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 f0b615be
...@@ -55,7 +55,10 @@ ...@@ -55,7 +55,10 @@
#endif #endif
#define NL_EXT4_ERROR_GROUP 1 #define NL_EXT4_ERROR_GROUP 1
#define EXT3_ERROR_MAGIC 0xAE43125U
#define EXT4_ERROR_MAGIC 0xAE32014U #define EXT4_ERROR_MAGIC 0xAE32014U
struct ext4_err_msg { struct ext4_err_msg {
int magic; int magic;
char s_id[32]; char s_id[32];
......
...@@ -455,6 +455,8 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno) ...@@ -455,6 +455,8 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno)
struct ext4_err_msg *msg; struct ext4_err_msg *msg;
if (ext4nl) { if (ext4nl) {
if (IS_EXT2_SB(sb))
return;
size = NLMSG_SPACE(sizeof(struct ext4_err_msg)); size = NLMSG_SPACE(sizeof(struct ext4_err_msg));
skb = alloc_skb(size, GFP_ATOMIC); skb = alloc_skb(size, GFP_ATOMIC);
if (!skb) { if (!skb) {
...@@ -466,7 +468,10 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno) ...@@ -466,7 +468,10 @@ static void ext4_netlink_send_info(struct super_block *sb, int ext4_errno)
if (!nlh) if (!nlh)
goto nlmsg_failure; goto nlmsg_failure;
msg = (struct ext4_err_msg *)NLMSG_DATA(nlh); 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)); memcpy(msg->s_id, sb->s_id, sizeof(sb->s_id));
msg->s_flags = sb->s_flags; msg->s_flags = sb->s_flags;
msg->ext4_errno = ext4_errno; msg->ext4_errno = ext4_errno;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册