lkml.org 
[lkml]   [2023]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/3] erofs: convert to use kobject_is_added()
Date
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

\
 
 \ /
  Last update: 2023-04-06 19:54    [W:0.087 / U:2.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site