sysfs: sysfs_update_group always fails and generates a WARNING CALL-trace
PATCH 1/1 sysfs: sysfs_update_group always fails and generates a WARNING CALL-trace
@sysfs_update_group@ always fails and borns a WARNING CALL-trace if the group exists. BUT still now, no *reference* of this routine at all.
Quoted 1 line
From
fe40df7d716658a1fbdab79768628c81d4363428Mon Sep 17 00:00:00 2001
From: yanyg <[email protected]>
Date: Wed, 16 Jan 2013 11:25:15 +0800
Subject: [PATCH] sysfs-fixes:
@sysfs_update_group@ always fail and generates WARNING CALL trace. fix @internal_create_group@ to avoid it.
--- fs/sysfs/group.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
fs/sysfs/group.c +10 -4
@@ -60,7 +60,7 @@ static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) {struct sysfs_dirent *sd; -int error; +int error, do_put =0 ;BUG_ON (!kobj || (!update && !kobj->sd));
@@ -73,9 +73,14 @@ static int internal_create_group(struct kobject *kobj, int update,return -EINVAL ; }if (grp->name) { - error =sysfs_create_subdir (kobj, grp->name, &sd); -if (error) -return error; + sd =sysfs_get_dirent (kobj->sd,NULL , grp->name); +if (sd) { + do_put =1 ; + }else { + error =sysfs_create_subdir (kobj, grp->name, &sd); +if (error) +return error; + } }else sd = kobj->sd;sysfs_get (sd);
@@ -85,6 +90,7 @@ static int internal_create_group(struct kobject *kobj, int update,sysfs_remove_subdir (sd); }sysfs_put (sd); +if (do_put)sysfs_put (sd);return error; }
Signature · 1 line
1.7.2.5
Greg KH
maintainerQuoted 2 lines · yanyg
@sysfs_update_group@ always fails and borns a WARNING CALL-trace if the group exists. BUT still now, no *reference* of this routine at all.
I don't understand.
Quoted 7 lines
Quoted 1 line
From
fe40df7d716658a1fbdab79768628c81d4363428Mon Sep 17 00:00:00 2001From: yanyg <[email protected]>
Date: Wed, 16 Jan 2013 11:25:15 +0800
Subject: [PATCH] sysfs-fixes:@sysfs_update_group@ always fail and generates WARNING CALL trace. fix @internal_create_group@ to avoid it.
Why did you embed the patch here, with the words above it? I would have to edit it to apply it :(
It's also not in a format I can apply (no signed-off-by: line.)
Quoted 36 lines
--- fs/sysfs/group.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)fs/sysfs/group.c +9
-4@@ -60,7 +60,7 @@ static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) {struct sysfs_dirent *sd; -int error; +int error, do_put =0 ;BUG_ON (!kobj || (!update && !kobj->sd));@@ -73,9 +73,14 @@ static int internal_create_group(struct kobject *kobj, int update,return -EINVAL ; }if (grp->name) { - error =sysfs_create_subdir (kobj, grp->name, &sd); -if (error) -return error; + sd =sysfs_get_dirent (kobj->sd,NULL , grp->name); +if (sd) { + do_put =1 ; + }else { + error =sysfs_create_subdir (kobj, grp->name, &sd); +if (error) +return error; + } }else sd = kobj->sd;sysfs_get (sd);
fs/sysfs/group.c static int internal_create_group(struct kobject *kobj, int update, · line 93
Quoted 4 lines
fs/sysfs/group.c +1
-0@@ -85,6 +90,7 @@ static int internal_create_group(struct kobject *kobj, int update,sysfs_remove_subdir (sd); }sysfs_put (sd); +if (do_put)sysfs_put (sd);
Always run your patches through scripts/checkpatch.pl and fix the problems it tells you about.
What code in the kernel is hitting this today?
thanks,
greg k-h
Sorry. I'm a fresh. This is my first patch commit. And still now *mutt* does not configured properly.
I will study howto and commit patch again. Sorry.
-------------------
Quoted 4 lines · yanyg
Quoted 2 lines
@sysfs_update_group@ always fails and borns a WARNING CALL-trace if the group exists. BUT still now, no *reference* of this routine at all.
I don't understand.
OK, sysfs routine @sysfs_update_group@ *never* works properly
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
From
fe40df7d716658a1fbdab79768628c81d4363428Mon Sep 17 00:00:00 2001From: yanyg <[email protected]>
Date: Wed, 16 Jan 2013 11:25:15 +0800
Subject: [PATCH] sysfs-fixes:
Quoted 6 lines
Quoted 2 lines
@sysfs_update_group@ always fail and generates WARNING CALL trace. fix @internal_create_group@ to avoid it.
Why did you embed the patch here, with the words above it? I would have to edit it to apply it :(
It's also not in a format I can apply (no signed-off-by: line.)
So sorry.
Quoted 44 lines
Quoted 37 lines
--- fs/sysfs/group.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)fs/sysfs/group.c +9
-4@@ -60,7 +60,7 @@ static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) {struct sysfs_dirent *sd; -int error; +int error, do_put =0 ;BUG_ON (!kobj || (!update && !kobj->sd));@@ -73,9 +73,14 @@ static int internal_create_group(struct kobject *kobj, int update,return -EINVAL ; }if (grp->name) { - error =sysfs_create_subdir (kobj, grp->name, &sd); -if (error) -return error; + sd =sysfs_get_dirent (kobj->sd,NULL , grp->name); +if (sd) { + do_put =1 ; + }else { + error =sysfs_create_subdir (kobj, grp->name, &sd); +if (error) +return error; + } }else sd = kobj->sd;sysfs_get (sd);fs/sysfs/group.c static int internal_create_group(struct kobject *kobj, int update, · line 93
Quoted 4 lines
fs/sysfs/group.c +1
-0@@ -85,6 +90,7 @@ static int internal_create_group(struct kobject *kobj, int update,sysfs_remove_subdir (sd); }sysfs_put (sd); +if (do_put)sysfs_put (sd);Always run your patches through
scripts/checkpatch.pland fix the problems it tells you about.
Quoted 1 line
What code in the kernel is hitting this today?
I write a simply virtual block device driver which calls @sysfs_update_group@ to updates attributes and modes, it fails. YOU can reproduce the bug by append @sysfs_update_group@ at below any of @sysfs_create_group@ call.
Quoted 5 lines
thanks,
greg k-h
So too sorry for my silly.
yanyg02