Messages in this thread | | | From | Yangtao Li <> | Subject | Re: [PATCH 2/3] erofs: convert to use kobject_is_added() | Date | Fri, 7 Apr 2023 01:52:59 +0800 |
| |
Hi Greg,
> That isn't going to work, and as proof of that, the release callback > should be a simple call to kfree(), NOT as a completion notification > which then something else will go off and free the memory here. That > implies that there are multiple reference counting structures happening > on the same structure, which is not ok.
The release() function did nothing inside, but we need to wait asynchronously...
Can we directly export the kobject_cleanup(kobj) interface so that kobj_type->release() doesn't have to do anything?
If do it, the use of init_completion, wait_for_completion, etc. will no longer be needed.
> OR we pull it out of the structure and just let it hang off as a separate > structure (i.e. a pointer to something else.)
Make something like sbi->s_kobj a pointer instead of data embedded in sbi? When kobject_init_and_add fails, call kobject_put(sbi->s_kobj), and assign sbi->s_kobj = NULL at the same time?
Thx, Yangtao
| |