* [PATCH 1/2] f2fs: remove unnecessary kobject_del()
@ 2023-04-04 14:21 Yangtao Li
2023-04-04 14:21 ` [PATCH 2/2] erofs: " Yangtao Li
0 siblings, 1 reply; 4+ messages in thread
From: Yangtao Li @ 2023-04-04 14:21 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: Yangtao Li, linux-f2fs-devel, linux-kernel
kobject_put() actually covers kobject removal automatically, which is
single stage removal. So it is safe to kill kobject_del() directly.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/sysfs.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index dfbd17802549..d5712627fc96 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -1472,14 +1472,11 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
}
- kobject_del(&sbi->s_stat_kobj);
kobject_put(&sbi->s_stat_kobj);
wait_for_completion(&sbi->s_stat_kobj_unregister);
- kobject_del(&sbi->s_feature_list_kobj);
kobject_put(&sbi->s_feature_list_kobj);
wait_for_completion(&sbi->s_feature_list_kobj_unregister);
- kobject_del(&sbi->s_kobj);
kobject_put(&sbi->s_kobj);
wait_for_completion(&sbi->s_kobj_unregister);
}
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] erofs: remove unnecessary kobject_del()
2023-04-04 14:21 [PATCH 1/2] f2fs: remove unnecessary kobject_del() Yangtao Li
@ 2023-04-04 14:21 ` Yangtao Li
2023-04-06 3:52 ` Gao Xiang
0 siblings, 1 reply; 4+ messages in thread
From: Yangtao Li @ 2023-04-04 14:21 UTC (permalink / raw)
To: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
Cc: Yangtao Li, linux-erofs, linux-kernel
kobject_put() actually covers kobject removal automatically, which is
single stage removal. So it is safe to kill kobject_del() directly.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/erofs/sysfs.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 435e515c0792..c3ba981b4472 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -240,11 +240,8 @@ void erofs_unregister_sysfs(struct super_block *sb)
{
struct erofs_sb_info *sbi = EROFS_SB(sb);
- if (sbi->s_kobj.state_in_sysfs) {
- kobject_del(&sbi->s_kobj);
- kobject_put(&sbi->s_kobj);
- wait_for_completion(&sbi->s_kobj_unregister);
- }
+ kobject_put(&sbi->s_kobj);
+ wait_for_completion(&sbi->s_kobj_unregister);
}
int __init erofs_init_sysfs(void)
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] erofs: remove unnecessary kobject_del()
2023-04-04 14:21 ` [PATCH 2/2] erofs: " Yangtao Li
@ 2023-04-06 3:52 ` Gao Xiang
2023-04-06 9:41 ` Yangtao Li
0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2023-04-06 3:52 UTC (permalink / raw)
To: Yangtao Li, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
Cc: linux-erofs, linux-kernel
Hi Yangtao,
On 2023/4/4 22:21, Yangtao Li wrote:
> kobject_put() actually covers kobject removal automatically, which is
> single stage removal. So it is safe to kill kobject_del() directly.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Would you mind taking a look at
commit a942da24abc5 ("fs: erofs: add sanity check for kobject in erofs_unregister_sysfs")
, which could be "git-blame"ed (I'd suggest looking into these
blame first), and the related discussion was:
https://lore.kernel.org/r/CAD-N9QXNx=p3-QoWzk6pCznF32CZy8kM3vvo8mamfZZ9CpUKdw@mail.gmail.com
https://lore.kernel.org/r/20220315075152.63789-1-dzm91@hust.edu.cn
TL;DR: I guess it could be fixed as below if kobject_del() could
be killed safely:
if (sbi->s_kobj.state_in_sysfs) {
kobject_put(&sbi->s_kobj);
wait_for_completion(&sbi->s_kobj_unregister);
}
Thanks,
Gao Xiang
> ---
> fs/erofs/sysfs.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> index 435e515c0792..c3ba981b4472 100644
> --- a/fs/erofs/sysfs.c
> +++ b/fs/erofs/sysfs.c
> @@ -240,11 +240,8 @@ void erofs_unregister_sysfs(struct super_block *sb)
> {
> struct erofs_sb_info *sbi = EROFS_SB(sb);
>
> - if (sbi->s_kobj.state_in_sysfs) {
> - kobject_del(&sbi->s_kobj);
> - kobject_put(&sbi->s_kobj);
> - wait_for_completion(&sbi->s_kobj_unregister);
> - }
> + kobject_put(&sbi->s_kobj);
> + wait_for_completion(&sbi->s_kobj_unregister);
> }
>
> int __init erofs_init_sysfs(void)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] erofs: remove unnecessary kobject_del()
2023-04-06 3:52 ` Gao Xiang
@ 2023-04-06 9:41 ` Yangtao Li
0 siblings, 0 replies; 4+ messages in thread
From: Yangtao Li @ 2023-04-06 9:41 UTC (permalink / raw)
To: hsiangkao
Cc: chao, frank.li, huyue2, jefflexu, linux-erofs, linux-kernel, xiang
HI Gao Xiang,
> Would you mind taking a look at
> commit a942da24abc5 ("fs: erofs: add sanity check for kobject in erofs_unregister_sysfs")
>
> , which could be "git-blame"ed (I'd suggest looking into these
> blame first), and the related discussion was:
>
> https://lore.kernel.org/r/CAD-N9QXNx=p3-QoWzk6pCznF32CZy8kM3vvo8mamfZZ9CpUKdw@mail.gmail.com
> https://lore.kernel.org/r/20220315075152.63789-1-dzm91@hust.edu.cn
> TL;DR: I guess it could be fixed as below if kobject_del() could
> : be killed safely:
>
> if (sbi->s_kobj.state_in_sysfs) {
> kobject_put(&sbi->s_kobj);
> wait_for_completion(&sbi->s_kobj_unregister);
> }
Thanks for your review and detailed explanation.
MBR,
Yangtao
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-06 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 14:21 [PATCH 1/2] f2fs: remove unnecessary kobject_del() Yangtao Li
2023-04-04 14:21 ` [PATCH 2/2] erofs: " Yangtao Li
2023-04-06 3:52 ` Gao Xiang
2023-04-06 9:41 ` Yangtao Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®