lkml.org 
[lkml]   [2006]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [Bug? Report] kref problem
    On Thu, Mar 16, 2006 at 08:07:57PM +0300, Artem B. Bityutskiy wrote:
    > On Thu, 2006-03-16 at 08:53 -0800, Greg KH wrote:
    > > > static void a_release(struct kobject *kobj)
    > > > {
    > > > struct my_obj_a *a;
    > > >
    > > > printk("%s\n", __FUNCTION__);
    > > > a = container_of(kobj, struct my_obj_a, kobj);
    > > > sysfs_remove_dir(&a->kobj);
    > >
    > > Woah, don't do that here, the kobject core already does this. A release
    > > function is for you to release the memory you have created with this
    > > kobject, not to mess with sysfs.
    > So do you mean this (attached) ? Anyway I end up with -1 kref.

    No file was attached :(

    Care to try again?

    > My real task is: I have sysfs directory /sys/A which corresponds to my
    > module, to my subsystem. There I want to create subdirectories
    > like /sys/A/B/ and delete them from time to time.

    What kind of subsystem are you creating that you are using raw kobjects?

    > So the problem is that whenver I remove B I end up with A's kref
    > decremented.

    And does A go away? Or is it still there in sysfs?

    > The attached test
    > demonstrates this. P;ease, look at its output:
    >
    > a inited, kref 1
    > b inited, kref 1
    > dir A created, A kref 1, B kref 1
    > dir B created, A kref 1, B kref 1
    > dir B removed, A kref 1, B kref 1
    > b_release
    > a_release <--- What is this? I removed B, not A ???
    > kobj B put, A kref 0, B kref 0
    > dir A removed, A kref 0, B kref 0
    > kobj A put, A kref -1, B kref 0

    -ENOFILE :(

    thanks,

    greg k-h
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-03-16 18:20    [W:0.024 / U:0.252 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site